Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
- Subject: Re: Safari: When do changes to a <textarea> show up in AppleScript "get the text..."
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 20 Oct 2009 17:43:05 -0400
Never. The initial contents only appear because they're part of the
HTML source of the page. To get changes after the page is loaded,
you'll have to use JavaScript.
A web page is an in-memory object tree that is initialized from the
HTML, but not maintained in HTML form when it changes.
On Tuesday, October 20, 2009, <email@hidden> wrote:
> I have the following script that I use to read the text of a Safari document and write it to a file:
>
> tell application "Safari"
> set txt to get the text of document 1
> end tell
> set f to a reference to file ((path to desktop as string) & "justTesting1")
> open for access f with write permission
> write txt to f
> close access f
>
> If I have a web page displayed in Safari that has a <textarea> in it, then the contents of the <textarea> appear in the text written to the file.
>
> However, if I merely change the contents of the <textarea> and then delete the file contents and rerun the script I still get the value of the <textarea> before I changed it.
>
> If I click a button that causes part of the page to be reloaded and then delete the file contents and rerun the script I get the new value of the <textarea>
>
> I guess my question is when do changes I type into a <textarea> get bound to the text of document 1?
>
> Thanks,
>
> Jerry
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden