I simply want to be able to click on the Safari icon and have Safari (3.1) open and automatically execute the menu item (History/Reopen all windows from last session), so I have firefox session saver functionality. I made an automator workflow that when run opens Safari and runs a “watch me” action that clicks the menu item for me. My solution is slow and clunky but works, there must be a better way.
I don’t have any scripting experience so I thought I’d come here for some help and advice from the pro’s.
The following is working on 10.4.11 with Safari 3.1.1.
You won’t be able to click Safari’s icon to run it, but you could save it as an application and give it a unique Dock icon instead… if that’s what you want.
Otherwise call it from the script menu, or assign it to a key combo with a third party app.
(It occurs that - being a menu item - you may be able to simply set a key combo in the Keyboard & Mouse pref pane.)
Peter B.
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item 10 of menu 1 of menu bar item "History" of menu bar 1
end tell
end tell
Just a detail: the posted script works only for Safari used in English.
This one:
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item 10 of menu 1 of menu bar item 6 of menu bar 1
end tell
end tell
may be used worldwide
Yvan KOENIG (from FRANCE jeudi 15 mai 2008 21:42:47)
That was the hint I needed. While I was waiting for help I found a plugin that gives me this function and much more.
If anyone else needs to open (last session) tabs when starting Safari try Glims from Machangout.com.