repeat within a repeat command

So i worked out the following scripts with the help of Craig Williams and Stefan K (Thanks guys). I have hit a snag though when using them. Because of a snag in the software I’m using, I basically I have to fuse the two together to accomplish the following:

  1. Check application to see if it is done processing
  2. If done, check folder size of myFolder (see if it is still copying data)
    A) If yes- Check application to see if it is done processing (Or repeating step one)
    B) If no- end repeat and move on.

This basically has to be done because if I am running a process on multiple items, once the first one is done, the script moves on because it reads the first item is done processing.

So basically it looks like I need two repeat command scripts like below written in a bigger repeat command script, correct?

To check if the application is done processing:

	tell application "Cleaner 6.5.1" to Start encoding Destination "myFolder"
		if not check_cleaner_is_compressing() then exit repeat
	end repeat
end timeout

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

To check if the files are done copying:

set myFolder to ((path to desktop folder as text) & "myFolder:")
tell application "Finder" to set theFiles to files of folder myFolder
repeat with oneFile in theFiles
   repeat until checkStableSize(oneFile)
   end repeat
end repeat
say "done"

on checkStableSize(myFile)
   set f to quoted form of POSIX path of (myFile as alias)
   set sizeThen to first word of (do shell script "du -d 0 " & f)
   delay 2 -- seconds (set to longer if needed)
   set sizeNow to first word of (do shell script "du -d 0 " & f) as integer --coercing to integer fixes the quote problem
   return (sizeNow - sizeThen = 0)
end checkStableSize