Download a File through Safari with AppleScript -
Due to the reasons I really will not go, I have to write something in the Apple script, which is specially some files Will download (Just something that double click to double click on a person who will open the safari and will show them a web page when starting some downloads.) I can set the document's URL with Apple script, but that file Does not download This is a file that Safari thinks she understands, so she tries to open it directly, I need to download it on the file system.
Anything that I find on Google is called "URL access scripting", but when I use it AppleScript Editor asks me to select which application it is I do not think so (or do not know where it is) Other suggestions are to call command line tools to download the file, but the problem here is that the user has some cookies (s) in Safari, Because the author authorizes for processing, the command line tool will get an error
I think the question breaks down:
- How do I
To download a file, tell the application "Safari" ?
- Can I specify where to save this file? Or can it just go to the
download folder?
- Alternatively, I can configure Safari to not try to open some file types so that I can only copy the document / Div>
Apple script can not force itself to the Safari.
Currently I can estimate two 'hack' options:1 Start the download using Javascript. (Google for Real Script.)
Tell the App "Safari" JavaScript "Warning" ('Apple script executed successfully'); Open the Safari Download Manager and paste the URL into the document 1 end
2. via GUI scripting.
(Enabling Assistant Make sure device.)Tell the application "system events" that the application to set the clipboard to "http://www.google.nl/favicon.ico" Use "Safari" to activate the key stroke {Command Down, Option Down} Keystroke " Please specify by using the "Command Down"
AppleScript can not specify specific files to download, it can still change the default downgrade location:
( Make sure that the path exists and relaunch the safari.)shell writes "Default" com.apple.safari applePrint actually downloads "after downloading secure Open files "feature:
(restarting Make sure Safari.)Open script "defaults com.apple.Safari AutoOpenSafe Download -BoilNo"
Conclusions
AppleScript itself can not just achieve its goals
- Can I specify where to save this file? Or can it just go to the
Comments
Post a Comment