Useful and simple start up script.


1st post in this catagory and 2nd post btw. Real good site.

This is script is the most useful for it’s size I have, no where near my best though… lol It is one of my first but still use it every boot.

tell application "Safari"
end tell
tell application "System Events"
	tell process "Safari"
		tell menu bar 1
			tell menu bar item "history"
				tell menu "history"
					click menu item "reopen all windows from last session"
				end tell
			end tell
		end tell
	end tell
end tell

set val2 to 0
	set val2 to val2 + 1
		tell application "Safari"
			close window "Apple - Start"
		end tell
		set val1 to 0
	on error error_message
		set val1 to 1
	end try
	if val1 = 0 then exit repeat
end repeat
return {val1, val2}
--val1 checks an error. I could have just put on 'error error_message' (next line) 'set val1 to 1' (next line) 'exit repeat' but I wanted to show you an if statement (an else statement can also go below if you want it to do something on a negative reply).
--val2 just counts the repeats

You won’t regret putting this in start up items (as app).

More of my scripts on my imadrichard public folder. Visit! :):wink: