I have a routine that changes the default download location in Safari.
My issue is that the first time I try and download after running the script that changes it a window appears that asks me to “confirm your file download location” . As this is part of an automaton script I don’t want to have to confirm. In testing (when I have not reset the downloads to the default folder ) it does not ask again.
The window I referred to looks like a finder window the header caption is as I described and at the bottom I have open and cancel buttons. What I need to do is programmatically hit the open button.
The script below changes the folder
set Thefolder to alias “Macintosh HD:Users:petermitchell:Dropbox:”
set Dfolder to quoted form of POSIX path of Thefolder
tell application “Safari” to quit – Ensure Safari quit’s using repeat loop
tell application “System Events” – One delay makes the script stable
repeat while application process “Safari” exists
do shell script ("defaults write com.apple.Safari DownloadsPath " & Dfolder) --Change Default
tell application “Safari” to activate