downladed stack is not being actually saved
Nicolas Cueto
niconiko at gmail.com
Mon Mar 15 22:48:59 EDT 2010
Hello,
Well, I've given up and now humbly ask the list for help.
I'm scripting an automated stack-update function. Problem is, the
downloaded stack only seems to overwrite the local stack. I mean, I
can "see" the download progress, and afterwards the "new" stack's
Windows modification-date changes, but the customprop in which its
version number is stored remains the same.
Here in essence are the two main parts of my script.
First, the "check for update" part:
on setUp
start using stack "MyMainstack"
put "stack1,stack1.rev" & cr & "stack2,stack2.rev" into tStackFiles
set the stackFiles of "MyMainstack" to tStackFiles
put "stack1" into tStackToCheckForUpdate
put the cpVersionNumber of stack tStackToCheckForUpdate into
tStacksVersionNumber
put <a retrieved value> into tLatestVersionNumber
if tStacksVersionNumber <> tLatestVersionNumber then
## Download latest stack.
put tStackToCheckForUpdate into gStackToUpdate
modal "stack update MyMainstack"
end if
open stack tStackToCheckForUpdate
hide stack "MyMainStack"
end setUp
Second, the "stack download and save" part:
on downloadRoutine
put URLStatus(pUrl) into tStatus
switch tStatus
case word 1 of tStatus = "cached"
## Save the downloaded stack.
put gSaveStackDirectory & gStackToUpdate & ".rev" into tSaveasPath
set the lockMessages to true
go invisible URL pUrl
set the visible of stack gStackToUpdate to true
save stack gStackToUpdate as tSaveasPath
close stack gStackToUpdate
set the lockMessages to false
unload URL pUrl
break
end switch
end downloadRoutine
Once the modal stack closes, the "setUp" script above continues and
opens up the supposedly newer stack.
The only thing I could think of is that because I'm using "set the
stackFiles", and because the local and downloaded stacks have the same
name, the "save stack" command is re-saving the local stack. So, I
relocated that part of "on setUp" to after the "modal stack" call. No
luck, though.
What have I overlooked here?
Thank you.
--
Nicolas Cueto
More information about the use-livecode
mailing list