13 Replies Latest reply: Dec 5, 2011 11:47 AM by Annapolitan
caracos Level 1 (0 points)

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)