like pass, but without ending the handler

Sarah Reichelt sarah.reichelt at gmail.com
Wed Feb 28 22:59:54 EST 2007


On 3/1/07, Chipp Walters <chipp at chipp.com> wrote:
> Here's what I ended up with..Seems to work fine and I don't see any
> increase in processor usage on XP.
>
> Script of btn 1 (the "test" button)
>
> on mouseUp
>   answer getThing()
> end mouseUp
>
> function getThing
>   repeat forever
>     wait 100 millisecs with messages
>     if there is a file "C:/test.txt" then
>       put URL ("file:C:/test.txt") into tResult
>       delete file "C:/test.txt"
>       beep
>       exit repeat
>     end if
>   end repeat
>   return tResult
> end getThing
>
> Script of btn 2 (the "stop now" button)
>
> on mouseUp
>   put "stop Now" into URL("file:C:/test.txt")
> end mouseUp
> __________________


I use a similar scheme for inter-application communications, but there
is one check that you might need to insert. If you start reading the
file before it is completely written to, the file exists but it will
be empty. Unless the file can be legitimately empty, then I suggest
you add a check for that to your loop as well.

Cheers,
Sarah



More information about the use-livecode mailing list