Re: Testing export success from Quicktime
Re: Testing export success from Quicktime
- Subject: Re: Testing export success from Quicktime
- From: Axel Luttgens <email@hidden>
- Date: Fri, 20 Dec 2002 11:38:43 +0100
Two approches are conceivable.
Since you want to be able to wait until the completion of the export, as
well as to intercept an error that could eventually be returned by QTP,
this should be the job of the "with timeout" statement.
But first you need to evaluate how many time QTP needs to process a
movie on your machine.
This is likely to be proportional to the movie's duration. But this may
also depend on the choosen settings and other things (I never worked
with QTP, but you surely will think of the most relevant things).
Anyway, after some testings, you should be able to define some algorithm
that returns the time (in seconds) that would be needed to process an
arbitrary movie.
Generally speaking, your estimate doesn't need to be accurate, but just
should deliver some kind of an upper bound.
And make sure to include a "safety coefficient" in your evaluation, so
as to take into account such factors as a transient greater CPU load or
I/O usage.
With that, you could write something as :
tell application "QuickTime Player"
set timeNeeded to [your algorithm here]
with timeout of timeNeeded seconds
export movie 1...
end timeout
end
That way, any processing error would be returned to your script (so that
you could trap it with an "try...on error... end try" construct).
On the other hand, your script wouldn't be halted because of
AppleScript's default behavior (that is, considering that a statement,
sent to an application, lasting more than 60 seconds has failed).
Put in another way, if your script continues past the export statement
without an error, you could be sure your exportation has been
successfully completed.
The other approach would be to use the "ignoring application response"
construct, in the line of:
tell application "QuickTime Player"
ignoring application responses
export movie 1...
end ignoring
end
BUT.
You are then asking AppleScript to return immediately from the export
statement, without waiting for the processing to occur and to reach its end.
You wouldn't even be able to catch an error message, should an error
occur, since AppleScript wouldn't wait for any application response.
It would be up to you to handle every aspects (check for the creation of
the file, then wait for QTP not to write to the file anymore, etc).
That second approach may prove to provide more freedom in certain cases;
but I'm not sure this is what you wanted in this precise case.
HTH,
Axel
The Other Rob wrote:
I'm using this code to export QuickTime movies using preset settings:
tell application "QuickTime Player"
export movie 1 to file "OSX:frankenah.mov" as QuickTime movie using
settings alias "OSX:my_settings.qtes" with replacing
end tell
However the Quicktime files are fairly large and it's very important that
the files are correctly processed before the script continues.
What's the best way to include a facility in the script that will restart
the export process if any errors are encountered, and only let the script
proceed when exporting is successfully completed? I'm assuming some sort of
error handler, but I'm not sure which one...
Regards,
-Rob
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.