I’ve been trying to write an applescript to scale the selected image in finder to 200px, but i’m not having any luck getting it to save at the end. here’s the script i’m using
global orig
global newname
global newImage
tell application "Finder"
set theFiles to selection
end tell
repeat with i from 1 to number of items in theFiles
set theFile to item i of theFiles as string
tell application "Image Events"
launch
set newImage to open for access theFile
scale newImage to size 200
tell application "Finder"
set tempFileName to (home as string) & "Desktop:" & "art" & i & ".jpg"
end tell
save newImage as JPEG in file tempFileName with icon
close newImage
end tell
end repeat
and here’s the event log:
tell application "Finder"
get selection
{document file "B00068CUPO.01._SCLZZZZZZZ_.jpg" of folder "Desktop" of folder "samingle" of folder "Users" of startup disk}
get document file "B00068CUPO.01._SCLZZZZZZZ_.jpg" of folder "Desktop" of folder "samingle" of folder "Users" of startup disk
"Macintosh HD:Users:samingle:Desktop:B00068CUPO.01._SCLZZZZZZZ_.jpg"
end tell
tell application "Image Events"
launch
current application
open for access "Macintosh HD:Users:samingle:Desktop:B00068CUPO.01._SCLZZZZZZZ_.jpg"
17
scale 17 to size 200
end tell
tell application "Finder"
get home
"Macintosh HD:Users:samingle:"
end tell
tell application "Image Events"
save 17 as JPEG in file "Macintosh HD:Users:samingle:Desktop:art1.jpg" with icon
close 17
end tell
Any ideas why its not saving? I’ve tried creating a new file name like in the script shown here, and just overwriting the new file. Neither seems to work.
Thanks in advance.