Replacing Stacks in Memory

Michael Doub mikedoub at gmail.com
Tue Feb 16 14:51:12 EST 2016


ok, got it working.   Thanks for everyone's help.   Here is what I have 
done,

The launcher has a datagrid AppPicker contains the links to the files 
available to launch.

on mousedoubleup
    set the itemdel to tab
    put the dgHilitedLines of grp "AppPicker" into tLine
    put the dgDataOfLine[tLine] of grp "AppPicker" into tData
    put tData["theLink"] & "#" & the milliseconds into tURL -- this will 
force a reload is the same link is used
    if laststack is among the lines of the openstacks then -- if there 
is a stack in memory, delete it
       delete stack laststack
       put empty into laststack
    end if
    put the openstacks into stacklist  -- remember what was open before 
the call
    go URL tURL
    get the openstacks  -- figure out what is new, this must be the name 
of the new stack
    repeat for each line x in it
       if x is not among the lines of stacklist then
          put x into laststack
          exit repeat
       end if
    end repeat
end mousedoubleup



On 2/16/16 1:54 PM, Mark Waddingham wrote:
> On 2016-02-16 19:11, Michael Doub wrote:
>> I am building a launcher app the loads stacks from DropBox.
>> I am using
>>
>> go URL tURL where the tURL is the stack to load using the correct
>> DropBox format.
>>
>> This works great for the first load.  However, if I update the stack
>> in DropBox and try to reload tURL, it does not purge the existing
>> stack and load the new one.
>
> Okay so when you do 'go url tURL' what is actually happening is you 
> are doing:
>
>   go (<expr>)
>
> If <expr> evaluates to binary data which looks like a stackfile (after 
> the engine's tried viewing it as a name of stack, and failed) it will 
> try and load that binary data into memory as a stackfile. If there is 
> already a stackfile in memory with that name, then the normal engine 
> processes will kick-in and (most likely, as the stack doesn't have a 
> filename) cause the existing stack which is in memory to be preserved, 
> and the new one ditched.
>
> Now, a stack loaded with the above form will not have a filename, so 
> 'revert' won't work. Instead, you'll probably need to do:
>
>   delete stack <nameofstackwhichwasgourld>
>   go url ...
>
> Hope this helps!
>
> Mark.
>





More information about the use-livecode mailing list