Add text from TextEdit to Safari text field

I need a little guidance on how to take text from a TextEdit document and add it to an online field.

I need to be able to take the textName string (which is the first paragraph of an open text document) and add it to a field with ID of “Name”

Below is what I have so far. Any help would be appreciated.

=========

tell application "TextEdit"
	
	activate
	
	tell document 1
		
		set textName to paragraph 1
		
	end tell
	
end tell



tell application "Safari"
	
	open location "http://www.webpageform.com"
	
	delay 1
	
	do JavaScript "document.getElementByID('Name').value = '" & textName & "'"
	
end tell

Figured it out


tell application “Finder”

set theFile to item 1 of (get selection)

set fileRef to open for access (theFile as alias)

set fileContents to (read fileRef)

set textName to paragraph 1 of fileContents

close access fileRef

end tell

tell application “Safari”

open location "http://www.website.com/Event/Create"

activate

delay 1

do JavaScript "document.getElementById('Name').value = (\"" & textName & "\")" in document 1

end tell