How to tell when IDE is done loading

Michael Doub mikedoub at gmail.com
Sun Dec 28 13:44:22 EST 2014


This should help you see the problem I was trying to solve: Consider the 
following code:

local ctr

on openstack
     put "OpenStack" & cr
    put the allowinterrupts & cr after msg
    try
       put revloadedstacks() & cr after msg
    catch err
       put "revloadedstack not found" &  cr & err & cr after msg
    end try
    send "Mark_IDE_done" to me in 2 ticks
end openstack

on Mark_IDE_done
    add 1 to ctr
    put  allowinterrupts & cr after msg
    if allowinterrupts = false then
       if ctr < 25 then
          send "Mark_IDE_done" to me in 2 ticks
       end if
    else
       put "Startup Complete" & cr after msg
        put revloadedstacks() & cr after msg
    end if
end Mark_IDE_done

Assume this is code is in a stack on the desktop and livecode is not 
running.  When the user open this stack from the desktop you will see 
the following in the message box:

OpenStack
false
revloadedstack not found
219,7,11,revloadedstacks
118,7,11
465,7,11
true
Startup Complete
startupTest

Note that the OpenStack message is received before the initialization of 
the IDE has completed so when the revloadedstack function was called, it 
was not found.   if you look at the IDE home stack, you will see the 
interrupts are blocked until all of the IDE initialization is completed.

I think that some of your assumptions regarding the loading of stacks 
may be incorrect.  This is clearly showing that a users stack does in 
fact start execution before livecode initialization is completed.

The other interesting thing to note is that I found a plugin that looks 
like it was setting allowinterrupts to false and never setting it back 
to true.  I put that counter in the Mark_IDE_done handler so it would 
not fire forever as I was debugging.  Anyway, I sent off an email to the 
developer of the plugin to start the discussion with him off line.

I hope this clears things up for you.

Regards,
    Mike


On 12/28/14 12:53 PM, J. Landman Gay wrote:
> I'm still not sure you need to mess with any of this.  What does your script need to do when the IDE finishes loading?
>
> On December 28, 2014 10:29:36 AM CST, Michael Doub <mikedoub at gmail.com> wrote:
>> It does seem that allowinterupts is the correct vehicle to tell when
>> the
>> livecode part of the IDE has been fully initialized, but because of
>> user
>> written plugins it is not totally reliable.   Any other thoughts?   I
>> am
>> going to submit an enhancement request and see if something more
>> reliable could be made available longer term.





More information about the use-livecode mailing list