Waiting to move a file

We are trying to automate DVD production. We have been using DVD Studio Pro 2, and since that’s not scriptable, we have used QuicKeys to automate things as much as possible. There’s a slight problem we’re having. The problem code looks somewhat like this:


tell application "QuicKeys"
	play shortcut named "Make DVD img file"
	
end tell

tell application "Finder"
	--repeat until exists file "path:to:Finished DVD img File.img"
	--end repeat
	move "path:to:Finished DVD img File.img" to "path:to:final:destination:"
	
    set DVDFile to "unique DVD name"
			
	set name of document file "Finished DVD img file.img" of folder 	"path:to:final:destination:" to  DVDFile
end tell

The problem is that QuicKeys immeadiately returns a reply. It doesn’t wait for the whole shortcut to play. So, the script wants to continue onwards, even though the files it needs haven’t been created. So, I put in that repeat statement(what is now commented out) so it would loop until the file was created. However, having it loop like that really slows things down. Does anyone know of a better way to do this? Thank you for any help.

P.S. One other quick question. Does anyone know if DVD Studio Pro 3 is scriptable? Thanks again

QuickKeys was my first introduction to “telling a computer what to do.” :wink:

First: doesn’t QuickKeys allow you to move the file?

Hmm… ironically, it is possible that the repeated call to the “exists” command is slowing down the Finder, (just a guess). Try a delay:

repeat until exists file "whatever"
	delay 1
end repeat

Hmm… actually, that may be bad advice. The above would guarantee at least a full second wait per file, ie: checking for the existence of 60 files would take at least 1 minute.

Rather than use the delay command, maybe some other slowing bit of code to give the Finder time to process:

repeat until exists file "whatever"
	repeat 1000 times
		set x to 0
	end repeat
end repeat

Hmm… that’s probably also bad advice, (I wouldn’t be listening to me if I were you :wink: ).

Do you want to be really tricky? Maybe have QuickKeys create the file in a folder with a Folder Action attached, one that would finish the processing of the file.