I'm trying to write a script which opens a new tab using selected text as a url. For example, I select "www.hotscripts.org" then run the script which copies the selected text, opens a new tab, sets the url to "www.hotscripts.org". Only it doesnt work
Heres my code:
I cant get the script to copy the text. The reason I want this is because when you right click on selected text e.g. "http://www.apple.com/" you can choose go to address, but you cant do that when the http is omitted. And that bugs me
Heres my code:
PHP:
tell application "Safari" to activate
tell application "System Events" to keystroke "c" using command down
set myData to (the clipboard) as text
tell application "System Events" to keystroke "t" using command down
tell application "Safari" to set front document's URL to myData
I cant get the script to copy the text. The reason I want this is because when you right click on selected text e.g. "http://www.apple.com/" you can choose go to address, but you cant do that when the http is omitted. And that bugs me