Pause resume script

Trevor DeVore lists at mangomultimedia.com
Tue Mar 1 19:49:16 EST 2005


On Mar 1, 2005, at 4:20 PM, Hershel Fisch wrote:

> Hi, is there a way to pause resume a script meaning while a script is 
> in
> process to be paused by another script and when it finishes the first
> continues ?

If script 1 is the main script which can be paused by script 2 then you 
could do something like this:

local sScript1MsgID = 0
local sData   = "My Data to be processed"

on script1
	-- PROCESS CHUNK OF DATA

	--> PROCESS NEXT CHUNK OF DATA
	send "script1" to me in 0 seconds
	put result() into sScript1MsgID
end script1

on script2
	if sScript1MsgID > 0 then cancel sScript1MsgID

	--> DO WHATEVER I NEED TO

	--> GET SCRIPT1 GOING AGAIN
	script1
end script2


Script1 just does the data processing in small chunks.  At any time 
script2 can cancel the current call to script1 which stops it from 
executing the next time around.  It then does whatever it needs to and 
then restarts script1.  Would this work in your case?


-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the Use-livecode mailing list