Re: Scripting Safari's Preferences window
Re: Scripting Safari's Preferences window
- Subject: Re: Scripting Safari's Preferences window
- From: Andrew Oliver <email@hidden>
- Date: Sun, 13 Jul 2003 09:41:25 -0700
Urg. GUI scripting.
(watch for line wraps)
do shell script "defaults write -app safari WebKitJavaEnabled -boolean
true"
do shell script "defaults write -app safari WebKitPluginsEnabled -boolean
true"
do shell script "defaults write -app safari WebKitJavaScriptEnabled
-boolean true"
Of course, the *proper* way would be for Safari to expose these preferences
via its AppleScript dictionary but we all know when that'll happen, so we
have to resort to these hacks/workarounds.
On 7/13/03 9:05 AM, "Irwin Poche" <email@hidden> wrote:
>
This morning I was reading some newspaper articles online and found their
>
embedded, blinking, animated advertisements to be an annoying distraction.
>
>
Having had some luck with UI scripting and knowing that disabling plug-ins,
>
Java, and JavaScript within Safari would silence the little buggers I
>
decided to throw together a quickie UI script to do just that.
>
>
A few hours later, having had no success, I9m now realizing how difficult
>
that really is. The Window that Preferences opens can go by seven different
>
names: 3General2, 3Tabs2, 3Security2, etc. (and so could any other open
>
window). Nor can I go by window number. The window to be scripted could
>
have any window number since it may already be open. 3Front2 doesn't appear
>
to work either.
>
>
Even eliminating the 3what window2 issue, I still cannot figure out the
>
correct form of reference to use for the check boxes I want to click. If
>
the Security preferences window is open then this ought to work, but
>
doesn9t...
>
>
tell application "Safari" to activate
>
tell application "System Events"
>
tell process "Safari"
>
click check box "Enable Java" of window "Security"
>
click check box "Enable plug-ins" of window "Security"
>
click check box "Enable JavaScript" of window "Security"
>
end tell
>
end tell
>
>
Looking at the results of a 3get properties of UI elements...2 command is
>
not much help either. It looks like a Group may have to be referenced, but
>
I9m clueless on that.
>
>
Knowing how to click the Preferences window9s Security icon button would be
>
helpful also.
>
>
Any help is appreciated,
>
>
-Irwin
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.