Page 1 of 1

Getting a list of marked cards

Posted: Sun Jun 10, 2012 6:08 pm
by ncmac
What does this return a list of the marked cards separated by many, many returns in the field and how can I get the list of marked cards as a list without the empty lines between each?

on mouseUp
repeat with n = 1 to the number of cards in this stack
if the mark of card n is true then put the short name of card n into item 1 of line n of card field "DataField"
end repeat
end mouseUp

Thanks!

Re: Getting a list of marked cards

Posted: Sun Jun 10, 2012 6:25 pm
by jmburnod
Hi ncmac,
separated by many, many returns in the field
Yes, one empty line = one no-mark card

This function return the list of the mark cards without empty line

Code: Select all

function TheMarkedCards
   put empty into rTheMarkedCards
   repeat with n = 1 to the number of cards in this stack
      if the mark of card n is true then put the short name of card n & return after rTheMarkedCards
   end repeat
   delete char -1 of rTheMarkedCards
   return rTheMarkedCards
end TheMarkedCards

You can use also :

Code: Select all

filter MyVariable without empty
Best regards

Jean-Marc

Re: Getting a list of marked cards

Posted: Sun Jun 10, 2012 6:35 pm
by sturgis
The following should work also since you can directly access using the "marked" keyword.

Code: Select all

on mouseUp
   repeat with n = 1 to the number of  marked cards in this stack
        put the short name of marked card n into item 1 line n of field "DataField"
   end repeat
end mouseUp

Re: Getting a list of marked cards

Posted: Sun Jun 10, 2012 7:14 pm
by ncmac
Thank you all very much!