Make script repeat until a file has been added to a certain folder

I’m a total newbie but am fascinated by what I am seeing coming into the world of applescript. I am in the process of trying to write my first script for my church to help automate recording of the weekly messages. I have had partial success developing a workflow combined with automator scripts as well as my pieced together applescripts.

The workflow starts when the recording is finished in GarageBand and is set to be exported into iTunes for Burning CD’s. Activating the Script from the Menu Bar Does the following actions:

Launch Application iTunes - Bring the correct playlist to front - Uncheck all songs in playlist - click button export from GarageBand - Quit GarageBand Application - Get the Current Song (the one just imported) - Set Info of iTunes Songs - Pause iTunes - click button to Burn CD

It all worked great with my test GarageBand project which was only 10 seconds long and I thought I was golden. Problem was though that our Pastor is maybe a bit long winded and the messages tend to be over an hour. While GarageBand is mixing down and converting the audio for Export, the Workflow keeps on running and when it comes to the iTunes stuff to do the song is not there yet for it to work with.

I have had many short nights the past week looking at your Forums trying to crack this one myself by looking at others examples and it got me as far as it did but I cannot get this one. Here are the approaches that I was trying.

  1. I looked at seeing if I could write a script that would notice when the GarageBand Export window closed which would signify the process was finished. I couldn’t figure this out and my UI Inspector would freeze up when it was doing it’s Export stuff so I couldn’t see what that “sheet” or whatever it is that slides down then was called.

  2. Since the messages are always going to the same iTunes folder, I thought I could tell it to look for the arrival of a file with a creation date newer than 1 hour (since the other files would be from the previous weeks). It would be in a repeat until it saw this.

  3. Then I thought maybe I could look for an additional count to the number of items in that folder and when it noticed that there was a file added it would end the repeat.

I thought I better follow this with some script I saw on one of the Forum pages to notice until the file is fully loaded before it goes on after it notices the new file.

tell application “Finder”
set first_Size to “”
set second_Size to " "
set tf to (path to trash folder)
repeat until first_Size is equal to second_Size
set first_Size to size of (info for tf) as integer
delay 2
set second_Size to size of (info for tf) as integer
end repeat
– next action
end tell

But this still does not help me hold the script until the file arrives in the folder in the first place.

Any ideas would be greatly appreciated!
God bless,

Model: MacBook Pro 2.16 GHz Intel Core Duo
Browser: Safari 523.10
Operating System: Mac OS X (10.5)

I can’t help with the scripting, but we are aiming at similar things and my general approach may suit you and I wonder if you might be able to solve my wee problem.
Similarly, recording service I want to output about 7 CD’s by the end of coffee time and then publish the whole thing as a podcast. What I am doing is recording on a GB podcast track hitting P to insert a track break so that listeners can track jump thru notices intro or jump sermon sections. (normal format:- intro, notices, 1 song, sermon) then whilst we sing the last songs I hit ‘export to CD’ and burn 1 CD. The whole recording is about 50mins and the mix down, normalise and burn takes about 12 mins. what I would then like to do is burn multiple copies which I know would only take about 3 min each and we would be fine, however the only way I can do more copies is the same ‘export to CD’ and it mixes down normalises and takes 12 mins.
If I could get GB to burn to a CD image or get a script to work within GB to mix, normalise and burn x copies I would be happy.
I have a couple of helpers who are computer illiterate, they can cope with GB but anything else has to be extreamly simple. I have a workaround which is:- reinsert CD, use CDRevolution to copy CD, this takes 14 mins for copy 2 and about 7 mins for following copies.
By the way this way of working has a couple of nice advantages, if you put in track breaks (press P) when the keynote slides change in the sermon you can export sermon keynote (or powerpoint) to .jpg and drop them in the podcast track to get podcast with visually reasonably easily. publishing podcast with ‘send to iWeb’ is such a doddle.
If you or anyone else could write me a script to output x cd’s I would be very greatful and willing to pay for the programming.