Calculating status...

Jul 21, 2011 6:32 PM

Hi, I'm having problem running Javascript command in Applescript after upgrading to Safari 5.1

Never had problem running the script below in previous version of Safari. The script suppose to copy selected text in Safari but somehow after upgrading to Safari 5.1, it keeps returning "missing value" instead of the text that I've selected in Safari.

Any solution for this problem? Thanks in advance.



tell application "Safari"


          set selectedText to (do JavaScript "getSelection()" in document 1)

end tell

MacBook Pro, Mac OS X (10.7)

Categories: AppleScript 

Tags: applescript, safari_javascript