PDA

View Full Version : Creatubg a loop




thriftinkid
Jul 30, 2009, 09:42 AM
Hey guys,

I have some compression software I'm using that I need to create a loop command for. Long story, but basically I need the script to read if my compression status is still running. If it is, I need it to keep checking until it is done.

The following basic command gave returned this info when I ran it while compressing some video:

tell application "cleaner 6.5.1" to GetEncoderStatus

it returned:

{ProcessingState:ProcessRunning, NumPasses:2, CurrentPass:1, PercentDone:9.0}

I need to create a loop that either says if the ProcessingState=ProcessRunning, or if the PercentDone<100.0, then loop back and check again.
If the ProcessingState=ProcessStopped , or the PercentDone=100.0, quit cleaner 6.5.1

I just don't know how to write a script for a loop, or which would be the more stable variable to go by.

I posted some of the dictionary below. I don't know if this will help or not. Thanks in advance guys.

GetEncoderStatus v : get the current encoding status
GetEncoderStatus
→ EncodingStatus : current state


EncodingStatus n
properties
ProcessingState (ProcessStopped/ProcessRunning/ProcessPaused/ProcessSleeping, r/o)
NumPasses (integer, r/o)
CurrentPass (integer, r/o)
PercentDone (real, r/o)


BatchItemStatus v : Get the status of a given batch item.
BatchItemStatus integer : index of the batch item
→ bi_NoSetting/bi_Ready/bi_Paused/bi_Encoding/bi_Analyzed/bi_Skip/bi_SettingError/bi_Flattening/bi_Stopped/bi_Unflattened/bi_Done/bi_ErrorEncoding/bi_Flattened/bi_Deleted/bi_Uploading/bi_Uploaded/bi_ErrorUploading