[comp.sys.mac.hypercard] System 7.0 and the suspended

ollef@sics.se (Olle Furberg) (06/27/91)

   I use HC as an interface to a program I'm building. To be able to
display the result from the program I have to open a file and put it into
a card field.

  However: I don't wanna open it before MyApplication has given the
control back to HC. In System 6.0.x this was very easy with the
"suspended" global variable:

 
    open   "My Disk:MyApplication"
    wait until not(the suspended)
    open file "My Disk:output"
    read from file "My Disk:output" for 90000
    put it into cd fld result
    close file "My Disk:output"


But this doesn't work in 7.0, I guess it's because there are no more any MF,
and all this talk about "MultiTasking".


So how do I do? I mean, there must be some way to do this!? 


     /Olle


 

jkc@Apple.COM (John Kevin Calhoun) (06/29/91)

In article <1991Jun27.162944.24758@sics.se> ollef@sics.se (Olle Furberg)
writes:
>
>   I use HC as an interface to a program I'm building. To be able to
>display the result from the program I have to open a file and put it into
>a card field.
>
>  However: I don't wanna open it before MyApplication has given the
>control back to HC. In System 6.0.x this was very easy with the
>"suspended" global variable:
>
> 
>    open   "My Disk:MyApplication"
>    wait until not(the suspended)
>    open file "My Disk:output"
>    read from file "My Disk:output" for 90000
>    put it into cd fld result
>    close file "My Disk:output"
>
>
>But this doesn't work in 7.0, I guess it's because there are no more any MF,
>and all this talk about "MultiTasking".

MultiFinder "doesn't exist" in System 7.0 because it has been folded into the
System itself.  It's better integrated, more sophisticated, and newly dubbed
the Process Manager.

The only problem with your script under System 7.0 is that you need to give
the Process Manager a little more time to launch MyApplication and to make
it the current process -- after HyperCard launches MyApplication, it has to
call WaitNextEvent a couple of times before it will be switched out and
MyApplication will become the frontmost app.  You've assumed that
HyperCard is suspended as soon as it executes the first open command.

Here's the fix:

    open   "My Disk:MyApplication"
    wait until the suspended  -- give Process Mgr time to launch other app
    wait until not(the suspended)  -- wait until user brings HC back to front
    open file "My Disk:output"
    .
    .

Kevin Calhoun
jkc@apple.com