image
image

Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
Thread Tools
  #1  
Old May 25th, 2007, 07:30 AM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
xstatical is on a distinguished road
Unhappy Applescript help requested

Can someone with Applescript knowledge please tell me why this script does not work and suggest a fix. I copied it from part of a longer script I found on the internet to enable private browsing automatically when Safari is launched. After it launches Safari, the script crashes before private browsing is enabled so I assume the error occurs at that step.

-- Sets Private Browsing
-- Also automatically dismisses the pop-up information window
on run {}
activate application "Safari"
tell application "System Events" to tell application process "Safari"
click menu item "Private Browsing" of menu 1 of menu bar item "Safari" of menu bar 1
click button "OK" of window 1
end tell
end run
Reply With Quote
  #2  
Old May 25th, 2007, 08:24 AM
bobw's Avatar
The Late: SuperMacMod
 
Join Date: Mar 2001
Location: Phila,PA
Posts: 8,835
Thanks: 0
Thanked 2 Times in 1 Post
bobw has a spectacular aura aboutbobw has a spectacular aura about
Open this Scriplet in your Editor:

tell application "Safari" to activate
tell application "System Events"
tell process "Safari" to click menu item "Private Browsing" of menu "Safari" of menu bar 1
end tell


Make sure "Enable access for assistive devices" is checked in the Universal Acces pref pane of System Preferences.
__________________

Reply With Quote
  #3  
Old May 25th, 2007, 09:09 AM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
xstatical is on a distinguished road
Cool

Sorry to be inquisitive but what does "Enable access for assistive devices" do that makes the script work? Your script works like a charm but I still can't get it to click the ok button to close the pop-up window in the script. Any suggestions?
Reply With Quote
  #4  
Old May 25th, 2007, 09:24 AM
bobw's Avatar
The Late: SuperMacMod
 
Join Date: Mar 2001
Location: Phila,PA
Posts: 8,835
Thanks: 0
Thanked 2 Times in 1 Post
bobw has a spectacular aura aboutbobw has a spectacular aura about
The assist somehow supposedly makes the script work.

I can't take credit for the script.

I found it here;

http://bbs.applescript.net/viewtopic.php?id=12632

for more help with the script post there. It's a great resource for scripting.
__________________

Reply With Quote
  #5  
Old May 25th, 2007, 09:41 AM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,462
Thanks: 3
Thanked 10 Times in 9 Posts
Mikuro is on a distinguished road
"Enable access for assistive devices" is required to enable "GUI scripting", which lets you manipulate interface elements like buttons through AppleScript. You might still need to enable GUI scripting, which can be done in AppleScript Utility, located in /Applications/AppleScript.
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.2

I'm now a four-browser man. How on earth did this happen?!

Useful programs: PithHelmet, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 08:20 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.