AppleScript and MSSQl

Here is my problem:

I have roughly 10,000 thumbnails stored on a server with a naming convention of:

1-1
1-2
1-3
2-1
2-2
2-3
2-4 etc. etc.

Each file is a thumbnail of a photograph which was taken for one of our magazines, you can browse/search through these thumbnails through our intranet which pulls the relevant file info from a MSSQL database. The problem is that some of the images have limitations or restrictions on their use. The powers that be would like to plunk a big R or L in the lower corner of the image to let the designers know that there are usage limitations associated with the image. (The limitations/restrictions are displayed on the search results screen but we all know there will always be end users who don’t read, misread, misunderstand etc. etc. and the misuse of some of these images could open the window to litigation. Hence we want to be heavy handed with designating them with use restrictions.

For the most part a major portion of these images will be from about a dozen magazines so my plan was to use AS to plod through the folder holding them and pull the ones from the said dozen mags, open each one in PS and had the L or R to it via AS and badda bing badda boom, done.

That is until I starting plodding, no subfolders to indicate which magazine, ok, the file name must contain something intuitive, right? Well, you’ve seen them, the only thing intuitive about the file names is the sequential order they were entered into the DB. Groan.

So I need to get into the database itself to see which magazine each file is associated with and I’m not even sure that is feasible with AS alone. Is it?

I’m considering making a little Frankenstein of an app that uses RealBASIC to get the db info and AS to do the Photoshop work. Any suggestions, comments (except for laughter at my expense) or what not is appreciated.