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


Click here to return to the 'Toggle Safari Cookies: Never/Only from sites I visit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle Safari Cookies: Never/Only from sites I visit
Authored by: hejdor34 on Aug 17, '10 04:30:00AM
I modified the script to toggle 'Accept Cookies' from 'Never' to 'Only from sites I visit' ;-)

tell application "Safari" to activate
tell application "System Events"
	tell application process "Safari"
		click menu item "Preferences…" of menu "Safari" of ¬
			menu bar item "Safari" of menu bar 1
	end tell
	tell application "System Events"
		click button "Security" of tool bar 1 of window 1 of ¬
			application process "Safari"
		delay 1
		if the value of radio button "Never" of radio group 1 of group 1 of group 1 of window "Security" of application process "Safari" is 0 then
			click radio button "Never" of ¬
				radio group 1 of group 1 of group 1 of window "Security" of application process "Safari"
		else
			click radio button "Only from sites I visit" of ¬
				radio group 1 of group 1 of group 1 of window "Security" of application process "Safari"
		end if
		get value of radio button "Never" of ¬
			radio group 1 of group 1 of group 1 of window "Security" of application process "Safari"
		copy the result as number to varResult
		if varResult = 1 then
			set varResult to "'Never'"
		else
			set varResult to "'Only from sites I visit'"
		end if
		click button 1 of window "Security" of application process "Safari"
		display dialog ("\"Toggle Cookies On/Off \" script Confirmation:" & ¬
			return & return & "'Accept Cookies' is set now to " & varResult & ".") ¬
			buttons {"OK"} default button "OK" giving up after 3 with icon 1
	end tell
end tell
Edited on Aug 17, '10 04:35:05AM by hejdor34


[ Reply to This | # ]