Waiting for process to finish

Dear all,

My first post so hello everybody! I recently converted to macs running OS X and even thought they never appealed to me before this OS X is the best developer OS I have ever used. Anyway

I have the following applescript


tell application "Flash 8"
	open file "Macintosh HD:cvscheckout:build.jsfl"
end tell

which I can also run by typing

osascript -e ‘tell application “Flash 8” to open posix file “/cvscheckout/build.jsfl”’

at the command line

The problem I have is that once flash has launched the script exits. Flash then goes off in a world of its own and I can not tell when it has finished processing the jsfl file. I also don’t know how to catch the output to a log to make sure it has processed everything without error.

So is there anyway to halt the launching process until the launched process has stopped?

Thanks

Conrad

Model: MacBook Pro
AppleScript: 1.10.6
Browser: Firefox 1.5.0.4
Operating System: Mac OS X (10.4)

I don’t have Flash 8, so can’t help you with that, but both of your scripts are doing the right thing. In both, you command Flash 8 to open a file and when the script has done that, it quits as expected.

If you want your script to stay open, it has to have something else to do that depends on what Flash is doing. If Flash is building a new file, for example, you can do a loop to get the size of that file and when it has been steady for a cycle, Flash is done. Without more detail, I can’t say much more.

Thank you,

after a brief search of these forums I found the following solutions to part of the problem

repeat
	delay 5
	tell application "System Events"
		if not (exists process "Flash") then
			exit repeat
		end if
	end tell
end repeat

and this works perfectly since the ‘open file’ does not exit until flash is running. I have seen that there is an on idle handler and this could be written using that. Whats more efficient ‘delay 5’ or an on idle handler that does a ‘return 5’ at the end?

Conrad

The idle handler is more efficient (in terms of cpu use).