Page 1 of 1

Deleting several special cards [Solved]

Posted: Wed Jul 22, 2015 5:03 pm
by atout66
Hi to all,

I'm trying to delete some cards of a stack with the char "-" in their name.
Example of names of cards to delete: "ach-pach" or "ach-rach", etc.
Here is the code:

Code: Select all

repeat with bb = 1 to the number of cards
               put the short name of card bb into tName       
               if tName <> "premiereCard" then -- we keep always the card where the script is running
                    get offset("-",tName)
                    if IT > "0" then -- "al-mal" for example
                         delete card tName
                    end if
               end if
          end repeat
This code work fine while I'm debugging, but as they are 1621 cards to remove, I put the breakpoints away (normal!) :wink:
Now I get an error which says that it can't find the card "uz" for example.
And this card has no "-" in its name ?!? :shock:

Any idea what's wrong in that code ?
Thanks in advance, Jean-Paul.

Re: Deleting several special cards

Posted: Wed Jul 22, 2015 5:18 pm
by Klaus
Bonjour Jean-Paul,

maybe you should start this way:
...
repeat with bb = the number of cards down to 1
...
:D


Best

Klaus

Re: Deleting several special cards

Posted: Wed Jul 22, 2015 5:30 pm
by atout66
Wouha, fantastic this "the number of cards down to 1" :)
Works perfectly, thanks a lot Klaus.

Regards, Jean-Paul.