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


Click here to return to the 'Set Safari's download folder via script for private browsing' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set Safari's download folder via script for private browsing
Authored by: maubrowncow on Aug 08, '06 02:06:13PM

looks like i'm getting a "NSReceiverEvaluationScriptError: 4" when the script sets Safari's download location. Specifically at:
click menu item "Preferences?" of menu 1 of menu bar item "Safari" of menu bar 1

any ideas? thanks.



[ Reply to This | # ]
Set Safari's download folder via script for private browsing
Authored by: pokaroo on Aug 09, '06 02:58:09PM

In answer to the question above regarding the "NSReceiverEvaluationScriptError: 4" error, since the script is a plain text file, the special characters required for the script to work are changed. You need to replace the '?' character at the end of 'Preferences' with the elipses character you get when pressing Option-;. I think you need to make this change in at least one other place as well - replace Other? with Other...

You should then be able to recompile and run the script properly.



[ Reply to This | # ]
Possible Fix for Scripting Error
Authored by: JKrahn on Aug 13, '06 04:25:21PM
I was having the same issue. It seems the the GUI scripting doesn't work as expected. I modified the script to use keystrokes rather than GUI scripting and it works just fine. (This may also extend it's ability to older versions of OS X). Let me know how it works for you. I've only posted the changed area, replace it into the existing script.


-- Sets Safari's download location
-- See comment below if the script fails during the setting of the download folder
on set_download_folder(dlFolder)
activate application "Safari"
tell application "System Events" to tell application process "Safari"
keystroke "," using {command down}
tell pop up button 3 of group 1 of group 1 of window "General"
click
keystroke (ASCII character 31) -- down arrow key
keystroke return -- return key
end tell
keystroke "g" using {shift down, command down}
delay 2 -- NOTE: This value should be increased if the new download location doesn't appear in the Go To Folder dialog
tell window "Go To Folder"
set value of text field 1 to dlFolder
click button "Go"
end tell
click button "Select" of sheet 1 of window "General"
click button 1 of window "General"
end tell
end set_download_folder

---
- JKrahn

[ Reply to This | # ]