safari
Applescript to start safari with tabs
22/Jun/2009 20:08 Filed in: Code

-- Applescript to open
Safari and preload tabs with specific URLS
-- Enter the URL for Tab 1-3
set Tab1_url to "http://www.newsgator.com"
set Tab2_url to "http://www.twitter.com"
set Tab3_url to "http://www.challengelogic.net"
-- Tell Safari to ope the new Tabs as specified
tell application "Safari"
activate
set the URL of document 1 to Tab1_url
my open_tab()
set the URL of document 1 to Tab2_url
my open_tab()
set the URL of document 1 to Tab3_url
my open_tab()
end tell
-- Subroutine to open a new tab
on open_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 open_tab
As you can see this script opens 3 web pages in new tabs, hopefully you can see how easy it would be to add additional code to open up even more sites as required. There is a slight problem with the script and that is you must set Safari so that new windows open with something other than the top sites page. I’m currently fairy new to Applescript but will try and fix this in a future version when I have more time. There may also be a better way of doing this. Until they feel free to try out my script at your peril :).
Read More...