[My upfront disclaimer - I am a new to applescript, although I do have some database programming experience from many years ago] Question: Is it possible to create an applescript droplet (or folder action) that when a jpg is dropped on it - it will show the user a small preview image and a pop-up text input dialog box that will allow the text typed in to be inserted into the caption field of the IPTC metadata without actually openning the image? I’m aware of the manay browsers and apps out there that can do the job (scripting GraphicConverter?) but am looking for a way to make the interface very simple with few options for the user. Idealy this script would work/or be adaptable in OS X and 9 . Many thanks to any that can give me advice.
This is tough for Applescript (AS). I believe that the only way to get any kind of an image in a display dialog (to retrieve user input) is to make the image a .icns file; essentially it needs to be an icon. I imagine that is possible, but I am not sure precisely how to do that.
As for setting the caption portion of the metadata tag, there is currently only limited ways to read metadata with AS alone; you need to invoke the do shell script command to get all the goods on a file’s metadata. I did discover this little goodie for setting the Description parameter of an image file, again invoking the shell:
set a to choose file with prompt "Choose an image file:"
set ff to quoted form of POSIX path of a
set b to text returned of (display dialog "Enter Description:" default answer "")
set bb to quoted form of b
do shell script "sips -s description " & bb & " " & ff
--Now to test it out
set tst to do shell script "sips -g description " & ff
tst
Now, whatever image you chose has whatever string you input as the ‘Description’ field in the image property element Description field. I have no idea how a metadata reader will access that information. iPhoto does not see it, nor does the shell script command mdls.
This is certainly an interesting idea you have; Hopefully someone out there has more information.
Thanks to all – looks like this would be a lot tougher than I thought. We currently use photomechanic - but ws looking for something simple of other users.
Jeff
It’s definitely possible as far as I can see but not simple. You’d need to learn a bit of Applescript Studio and Image Events to display your preview image to the user. The only decent way I’ve found of manipulating IPTC info is to use Python and a Python module called ‘IPTCinfo’, calling it through a ‘do shell script’. Hope this helps!
I’ve used some of the Java modules at the following address to allow users to add IPTC info to uploaded photos via a web page running servlets/jsp. I haven’t tried running Applescript and Java so am not sure if you’d be able to do a shell script call to java and these modules. But it is one possibility.