Hello. I am trying to write a script not to do something different that I am personally unable to perform, but rather to remove the necessity on my part for doing several repetitive tasks. I could probably do this in Automator, but I want to do it in Applescript, because I will more easily be able to manipulate it later.
I want just basically want to download an image that I highlight or select. Plain and simple. Nothing fancy for now, I just want to save the image to my computer. Thanks in advance for the help!
Actually, that is what I wanted to do… I want to save them to a folder other than my downloads folder… how do I do that? Or is it just a matter of writing the scripts to navigate the dialog? cuz I can do that, but I just wanted to know if there was a solely code way of doing it?
a work-around is to place a droplet in your Dock.
then drag & drop an image from Safari on to the droplet.
that should place it in a folder named (by you) ‘Downloaded Images’ within your Documents folder.
on run
tell me to display dialog "Please don't click on me." & return & "I'm an AppleScript droplet." & return & ¬
"Only drag and drop a file on me." buttons {"OK"} default button 1 cancel button 1 with icon stop
end run
on open (sourceFile)
tell application "Finder"
set home_path to home as text
set the_folder to (home_path & "Documents:Downloaded Images:")
set newFile to duplicate sourceFile to the_folder with replacing
delay 0.5
-- downloaded images will cache - the line below will delete them.
do shell script "rm -rf ~/Library/Caches/TemporaryItems/*"
end tell
end open
Tom
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)
Just a note on this. There is a bug in Mac OS that, for me, makes dragging an image to the deskto fail about 30% of the time. On all systems, Mac Pro and Macbook Pro (two different ones), since 10.5.x. Dragging some images will just not be seen by the OS, and I’ll have to manually right click them. Among other things, this makes Google Chrome’s ugly download bar pop up which I then have to close. So i am happy to have some other options too.