This is a pretty sophisticated endeavor and from how you describe it looks to be beyond the scope of actions invoked through the batch command.
re: "I don't know if Photoshop has a scripting language that would allow me to set if-then statements."
You're in luck. If you're into JavaScript or VBScript programming, PS7 can be enabled (via download from Adobe) to play scripts. The ability to play scripts is built into CS. No scripting for Photoshop 6 or prior versions.
A few RetouchPRO members have scripting background, so perhaps one or more will weigh in on this thread.
While you're waiting, if you haven't checked out the Scripting forum at Adobe.com, a lot of sharp programmer-types hang out there who would no doubt drool at the opportunity to advise on your particular issues.
Here's a link:
http://www.adobeforums.com/cgi-bin/w...Idz.0@.ef7f2cb
Hope this gets you moving.
~Danny~