Re: Google Chrome: Set variable to result of JavaScript
Re: Google Chrome: Set variable to result of JavaScript
- Subject: Re: Google Chrome: Set variable to result of JavaScript
- From: Nathan Greenstein <email@hidden>
- Date: Tue, 12 Jul 2011 07:40:34 -0700
Ah, that seems like the problem.
Thanks for the info!
--
Nathan Greenstein
email@hidden
On Mon, Jul 11, 2011 at 14:05, Christopher Stone
<email@hidden> wrote:
On Jul 11, 2011, at 15:28, Nathan Greenstein wrote:
I've been trying to get Chrome to do some _javascript_ in a tab, and set the result of that to an AppleScript variable.
______________________________________________________________________
Hey Nathan,
Part of your problem is that Chrome does not yet support getting a result from an executed _javascript_. The only way I know of at present is to set the title from js and pull that into Applescript, although there's probably a spiffier method that doesn't have a character limit.
tell application "Google Chrome"
tell front window
tell active tab
execute _javascript_ "document.title = 'some result';"
set x to title
end tell
end tell
end tell
I'm very pleased to see them starting to support Applescript, but they've got a little way to go yet.
--
Best Regards,
Chris
_______________________________________________
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
_______________________________________________
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