I have a script (so far) that I want to be able to drop an image on, have the script rotate it if it's taller than it is wide, and set it as desktop. It works except for the "set as desktop" part. (Note - I'm using pictures of stars, so i don't care what way it rotates it. See https://forums.macrumors.com/showthread.php?p=7524996#post7524996 (again - note - I have a better version if you want it.))
Please help me make it set the picture as desktop.
Script:
Note again, I dumped a bunch of code together, so it's not pretty, i don't care. It (almost) works.
Please help me make it set the picture as desktop.
Script:
Code:
on open some_items
repeat with this_item in some_items
try
rescale_and_save(this_item)
end try
end repeat
end open
to rescale_and_save(this_item)
tell application "Image Events"
launch
set the target_width to 120
-- open the image file
set this_image to open this_item
set typ to this_image's file type
copy dimensions of this_image to {current_width, current_height}
if current_height is greater than current_width then
rotate this_image to angle 90
else
tell application "Finder" to set this_image to desktop picture
end if
tell application "Finder" to set new_item to ¬
(container of this_item as string) & "scaled." & (name of this_item)
save this_image in new_item as typ
set this_image to desktop
picture
end tell
end rescale_and_save
Note again, I dumped a bunch of code together, so it's not pretty, i don't care. It (almost) works.