Measure File Copying time

Worked a little more on it yesterday. I finally just ended up just breaking it down to a simple command to see if I could even get a return. This is what I got.

tell application "cleaner 6.5.1" to GetEncoderStatus

It returned this:

{ProcessingState:ProcessRunning, NumPasses:2, CurrentPass:1, PercentDone:70.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.

Then my handler above schould work

this checks all 3 seconds if Cleaner is still processing


repeat
	if not check_cleaner_is_compressing() then exit repeat
end repeat


to check_cleaner_is_compressing()
	delay 3
	tell application "Cleaner 6.5.1"
		return ProcessingState of GetEncodingStatus is ProcessRunning
	end tell
end check_cleaner_is_compressing

I plugged in your script as follows:


set myFolder to ((path to desktop folder as text) & "Render")
tell application "Cleaner 6.5.1" to activate
tell application "Cleaner 6.5.1" to Clear
tell application "Finder"
	set Afolder to (myFolder) as alias
	try
		set a_list to every file in Afolder as alias list
	on error -- only one item present
		set a_list to every file in Afolder as alias as list
	end try
	repeat with i from 1 to number of items in a_list
		set a_file to (item i of a_list)
		tell application "Cleaner 6.5.1" to Add a_file
	end repeat
end tell
tell application "Cleaner 6.5.1" to Setting "web"
tell application "Cleaner 6.5.1" to Start encoding Destination "upload"

repeat
	if not check_cleaner_is_compressing() then exit repeat
end repeat


to check_cleaner_is_compressing()
	delay 3
	tell application "Cleaner 6.5.1"
		return ProcessingState of GetEncodingStatus is ProcessRunning
	end tell
end check_cleaner_is_compressing

I got the following error:

The variable GetEncodingStatus is not defined.

Am I missing a step?

Is it GetEncodingStatus

or GetEncoderStatus

?

I realized part of the script was miss spelled. It should be “GetEncoderStatus” ← Origninal command that gave me the return, or “EncodingStatus” not "GetEncodingStatus. SO I ran the following script:

set myFolder to ((path to desktop folder as text) & "Render")
tell application "Cleaner 6.5.1" to activate
tell application "Cleaner 6.5.1" to Clear
tell application "Finder"
	set Afolder to (myFolder) as alias
	try
		set a_list to every file in Afolder as alias list
	on error -- only one item present
		set a_list to every file in Afolder as alias as list
	end try
	repeat with i from 1 to number of items in a_list
		set a_file to (item i of a_list)
		tell application "Cleaner 6.5.1" to Add a_file
	end repeat
end tell
tell application "Cleaner 6.5.1" to Setting "web"
tell application "Cleaner 6.5.1" to Start encoding Destination "upload"

repeat
	if not check_cleaner_is_compressing() then exit repeat
end repeat



to check_cleaner_is_compressing()
   delay 3
   tell application "Cleaner 6.5.1"
       return ProcessingState of GetEncoderStatus is ProcessRunning
   end tell
end check_cleaner_is_compressing

tell application "Cleaner 6.5.1" to quit

and I got he following error:

Expected expression but found command name.

Should that command be in there somewhere or should it be the other option of “EncodingStatus” that I should be working in there?

Sorry, I don’t have the app so I can only guess.
It would be helpful to know in which line the error occurs.

Right, Sorry. And thank you again for sticking through this with me.

When i replace “GetEncodingStatus” with "GetEncoderStatus I get the following error:

Expected expression but found command name.


And GetEncoderStatus is highlighted

When I replace “GetEncodingStatus” with “EncodingStatus” I get the following error:

Can’t get ProcessingState of EncodingStatus.

And ProcessingRunning is highlighted

Script I worked off of:

set myFolder to ((path to desktop folder as text) & "Render")
tell application "Cleaner 6.5.1" to activate
tell application "Cleaner 6.5.1" to Clear
tell application "Finder"
   set Afolder to (myFolder) as alias
   try
       set a_list to every file in Afolder as alias list
   on error -- only one item present
       set a_list to every file in Afolder as alias as list
   end try
   repeat with i from 1 to number of items in a_list
       set a_file to (item i of a_list)
       tell application "Cleaner 6.5.1" to Add a_file
   end repeat
end tell
tell application "Cleaner 6.5.1" to Setting "web"
tell application "Cleaner 6.5.1" to Start encoding Destination "upload"

repeat
   if not check_cleaner_is_compressing() then exit repeat
end repeat



to check_cleaner_is_compressing()
delay 3
tell application "Cleaner 6.5.1"
return ProcessingState of GetEncodingStatus is ProcessRunning
end tell
end check_cleaner_is_compressing

tell application "Cleaner 6.5.1" to quit

if this above works, then this must work, too

tell application "cleaner 6.5.1" to set x to ProcessingState of GetEncoderStatus

then maybe also this works


to check_cleaner_is_compressing()
	delay 3
	tell application "Cleaner 6.5.1"
		set x to ProcessingState of GetEncoderStatus
		return (x is ProcessRunning)
	end tell
end check_cleaner_is_compressing

When I ran the following script solo while something was compressing, I got the following error:

tell application "cleaner 6.5.1" to set x to ProcessingState of GetEncoderStatus

Syntax Error:

Expected expression but found command name.

“GetEncoderStatus” is Highlighted

When I plugged your second script to the following I got the same error. And “GetEncoderStatus” is again highlighted.

set myFolder to ((path to desktop folder as text) & "Render")
tell application "Cleaner 6.5.1" to activate
tell application "Cleaner 6.5.1" to Clear
tell application "Finder"
	set Afolder to (myFolder) as alias
	try
		set a_list to every file in Afolder as alias list
	on error -- only one item present
		set a_list to every file in Afolder as alias as list
	end try
	repeat with i from 1 to number of items in a_list
		set a_file to (item i of a_list)
		tell application "Cleaner 6.5.1" to Add a_file
	end repeat
end tell
tell application "Cleaner 6.5.1" to Setting "web"
tell application "Cleaner 6.5.1" to Start encoding Destination "upload"

repeat
	if not check_cleaner_is_compressing() then exit repeat
end repeat


to check_cleaner_is_compressing()
   delay 3
   tell application "Cleaner 6.5.1"
       set x to ProcessingState of GetEncoderStatus
       return (x is ProcessRunning)
   end tell
end check_cleaner_is_compressing

I don’t know if this helps, but when I got then return with the GetEncoderStatus, All the text was blue (I underlined all of it) except for the following bolded characters. They were black:

 tell application "cleaner 6.5.1" to GetEncoderStatus

It returned this:

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

then try this


to check_cleaner_is_compressing()
	delay 3
	tell application "Cleaner 6.5.1"
		set theEncoderStatus to GetEncoderStatus
		return (ProcessingState of theEncoderStatus is ProcessRunning)
	end tell
end check_cleaner_is_compressing

if this doesn’t work either, I give up.
Maybe here there are some folks who use Cleaner and can help

It…Worked!!! Stefan you are a man among men. Thanks for working through this with me. Nobody else would have.

Thank goodness! :slight_smile: