Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Pass variables back and forth between Applescript and Javascript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Pass variables back and forth between Applescript and Javascript
Authored by: jonn8n on Dec 22, '05 09:18:57AM
Oh, and it works equally well for other types of returned values (NB: let AppleScript escape your text using the 'quoted form of ' command; manually adding quotes can lead to lots of problems):

tell application "Safari"
	set myVar to "My word:"
	set myVar to do JavaScript "
var myVar = " & (quoted form of myVar) & ";
myVar = myVar + ' cheese';
return myVar;
" in document 1
end tell
display dialog "myVar is now: " & myVar buttons {"OK"} default button 1 with icon 1 giving up after 5

Jon

[ Reply to This | # ]