Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Set Safari's home page via WiLMa and AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set Safari's home page via WiLMa and AppleScript
Authored by: yesiamnhoj on Feb 14, '07 02:03:54PM
I'm not sure why you'd want to make this change dependant on location, but here is a reduced version of your script that launches Safari whatever happens.
--reset the value of the Home Page
set HomePage to "http://www.google.com.au"
-- 'path to' is in the Standard Additions dictionary
set pListpath to ((path to preferences from user domain) as Unicode text) & "com.apple.internetconfigpriv.plist"

tell application "System Events"
	-- if the plist item does not contain the text
	if (value of property list item "WWWHomePage" of property list file pListpath) is not HomePage then
		-- set the item to the text
		set (value of property list item "WWWHomePage" of property list file pListpath) to HomePage
		-- if Safari is running, quit it
		if (name of every process) contains "Safari" then tell application "Safari" to quit
	end if
	-- whatever happens start Safari
	tell application "Safari" to launch
end tell
Best wishes
John M

[ Reply to This | # ]