Delete card loop crashes Rev

Robert Brenstein rjb at rz.uni-potsdam.de
Sun Dec 12 07:46:52 EST 2004


>I have a stack that I use to download entire sites, Card one is set 
>to cantDelete... I download the Table of contents page to that card, 
>then run a script that parse the page and downloads every page on 
>that has an href in the Table of Contents page... then dump to my 
>hard drive.. and viola... locally accessible tutorials..  When I go 
>to download a different site... I intend to delete the previous one 
>with this script:
>
>on mouseup
>   Answer "You are about to delete all data except card 1! This is 
>unrecoverable!" with "Cancel" or "Proceed"
>   if it is "Cancel" then exit mouseup
>   lock screen
>   put the number of cards of this stack into tLoops
>   go to card tLoops
>   repeat (tLoops-1) times
>    delete this card
>   end repeat
>end mouseup
>
>which consistently causes Rev to crash on Mac OSX
>
>Any clues? looks like a bug to me as I've used this script before 
>successfully for years in Supercard, Metacard and in earlier 
>renditions of Rev.
>
>Sivakatirswami

a) comment out the lock screen to see what is going on

the go to card tLoops takes you to the last card. When you delete it, 
you end up on the next which is the first card of the stack. Then you 
delete it. And I think that is where your script and the button 
resides.

b) try changing the loop

   repeat while the number of cards of this stack > 1
    go to the last card
    delete this card
   end repeat

this should also work and be more efficient

   repeat while the number of cards of this stack > 1
    delete the last card of this stack
   end repeat

c) I would change the logic of the program to avoid this altogether

keep the cards to be deleted in a substack which is a clone of a 
template substack, so you simply delete that entire substack. This 
may allow you to actually retain and support multiple sets in 
parallel.

Robert


More information about the use-livecode mailing list