Is it possible to use AppleScript to open a link in a new tab in Safari?
Thanks in advance!
Is it possible to use AppleScript to open a link in a new tab in Safari?
Thanks in advance!
Code:
tell application "System Events"
tell application "Safari" to activate
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
tell application "Safari"
set URL of document 1 to "http://www.stackoverflow.com/"
end tell
One problem is that this only works if the system's language is set to English.
This will work:
tell application "Safari"
tell window 1
set current tab to (make new tab with properties {URL:"http://www.stackoverflow.com"})
end tell
end tell