I’m completely new to writing Applescripts, and I’m looking for some help getting started. This seems pretty ambitious for an early attempt, but it will save me a huge amount of work. I need a script to help me search my company’s photo library and fill orders for photos. We receive requests in a variety of forms, so I think that converting each request to a plain text file would be the most consistent way to create input for the script. I was thinking to save the script as a droplet, then drop the text file on it to run. If there’s a better way to do it I’m certainly interested. The text file would contain a series of item numbers separated by line breaks like this (though it may contain over 200 items):
19911
17854-00
42457
28454
38744
21160-10
Here are the steps we use to do this manually, but I understand a script may not follow exactly the same process.
¢ Start with first item number.
¢ Open a mounted server (the photo library).
¢ In that window, open a category folder indicated by the first digit of the item number.
¢ In that window, search for a folder whose name matches the item number. If there isn’t a match, move on to the next item number.
¢ If a matching folder is found, open it and look for a .psd file named for the item number (21160-10.psd for example). If no .psd is found, move on to the next number.
¢ If the .psd is found, copy it to a holding folder on a local drive. This will always be the same holding folder, so it can be written directly into the script. There’s no need to choose a folder on running the script.
¢ Repeat with every item number.
¢ If it could at the end create a text file in the holding folder showing the item numbers not found that would be helpful, but not necessary.
What I would actually like help with is outlining the logic to make the script work, breaking it to sub-routines, and suggesting some relevant topics to study. I’ll then do the research and try to write the script myself. It already looks like I’ll need to read up on “try”, “if”, and “repeat” statements among other things. I think I’ll understand it better and learn more that way. Let me know if I need to provide any other info or clarify anything. Thanks in advance for any help anyone can give.
Model: PowerMac G5
Browser: Firefox 1.5.0.8
Operating System: Mac OS X (10.4)