As many of you know, there have been a number recent threads over the last few months concerning the oddites associated with trying to script the Image Events application. Most of the time, it will work if you tell Image Events to open the target file as an alias. Here is something else I have found, and it is making me mad:
set main_path to path to desktop as Unicode text
set a to choose file
set nfn to text returned of (display dialog "Enter new name:" default answer "")
set new_file to main_path & nfn & ".jpg"
tell application "Image Events"
set b to open (a as alias)
scale b by factor 0.1
save b in new_file
close b --Tried to do [save b closing in new_file] but it freaked and would not save.
end tell
This baby works fine as long as it is run in Script Editor with the Event Log pane highlighted. If you run it otherwise, or if you save it as an application, you get the fun error:
variable b not defined
This is truly exasperating, as I would like to use this to make a nifty HTML catalog of a bunch of non iPhoto disks of images I have collected. I have followed some of the recommendations of other similar threads, and investigated third party applications, but I would rather go straight to SIPS unless someone else has solved this strangeness.
I am running 10.4.3, Developer Tools installed
casdvm