Thursday, November 23, 2017

#1 2005-05-18 06:17:37 pm

From:: Arlington Heights, IL USA
Registered: 2004-09-30
Posts: 4

Opening Tabs in Safari in Tiger 10.4.1

I wasn't sure whether to put this in the Automator forum or here so if it doesn't belong here then please move it.

I made an automator script/application that basically just open 6 windows in Safari of pre-selected URL's that I want open. What I want to do is, instead of opening separate windows for each URL, I want it to open the URL's in tabs in one Safari window.

So with a little help from Apple's applescript help site I put the following applescript together:


on run {input, parameters}
tell application "Safari"
set the URL_list to the URL of every document
repeat with i from the (count of the the URL_list) to 2 by -1
set this_URL to item i of the URL_list
my new_tab()
set the URL of document 1 to this_URL
close window i
end repeat
on error the error_message number the error_number
display dialog the error_message buttons {"OK"} default button 1
end try
end tell

on new_tab()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
end new_tab

So basically, Automator gets the URL's and opens each URL in its own window and then this script is run that is supposed to put the URL's into tabs in one Safari window. For some reason I keep getting this error  NSUnknowKeyScriptError  with an Okay button to hit and it stops the script from finishing. The error comes up when it tries to put the second window/URL into tab#2 in Safari.

Any ideas, or is there an easier way to do this?


Filed under: safari, System



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)