The code that I started putting together at work is an automtor application with a run-applescript which does a save as pdf of all open .musx files in finale 2014 (music notation program). It kinda goes like this:
automator - [create folder "pdf export"]
automator - [get specifed finder items]
automator - [open finder items with Finale 2014]
AppleScript - [keystroke/print dialog commands to save the front document as a pdf in the "pdf export folder" on the desktop, then closes the file]
The probelm im having is a repeat condition - if i run the apple script in the automator it does it once, and I need it to do it to all the open files. If i repeat 200 times, but only brought in 30 finale files, its going to keep trying to repeat the script without an open file to do it to and won't continue in any line of code or in automator.
What I was thiinking is if I could "activate" finder, count the number of selected files that I brought into the Automator application, I could set that value-1 as the number of times to repeat the "save as pdf" run-applescript, and could continue with other applescript or automator commmands once the sequence has finished.
I guess the other option is a "repeat while" or "repeat until" command, but I dont know what that condition would be. At the end I should be left with Finale 2014 running wtih no more open documents and i'd like the sequence to finish.
idk of thats a
"repeat while front document of Finale 2014 exists"
sort of thing or what.
This is my 3rd day of applescripting but if I set the repeat x times to the number of files I bring into the automator/applescript, it works, which I'd say is decent progress, but I will be bringing varying numbers of files into that automator application quite often so i can't leave the repeat condition at a specified number.