Bark Dark

Jim Ault jimaultwins at yahoo.com
Thu Mar 31 20:23:14 EDT 2011


On Mar 31, 2011, at 3:29 PM, Bob Sneidar wrote:

> I don't think the property thing will work because I don't think you  
> can find a card with a property or enumerate them as such. (This  
> AIN'T Applescript man!"
>
The 'property thing' does not refer to the CARD properties,
but the customProperties of the STACK

---- tested in a working stack  ------------------
--note  fld statusCode  is NOT shared
--  flds desiredCodeString  notnowCodeString
--    ARE SHARED
-- fld output  is NOT shared
--  all fields are in a group that behaves as backgound


on doCustomPropertyRun
    --  I use 'cps' to mean 'cust prop set'
    set the customPropertySet of this stack to "cpsStatusCodes"
    --make this set empty
    set the customkeys of this stack to empty

    --you only need to do the repeat when changes are made
    --  or when the stack closes
    repeat with k = 1 to the number of cards
       put word -1 of the short id of  card k into thisCdId
       get k & "^" & word 1 to -1 of fld "statusCode" of card k
       replace cr with space in IT
       set the cpsStatusCodes[ thisCdId ] of this stack to IT
    end repeat
    save this stack --if it is run in the IDE, but not if an app

    --To get the list of 'marked cards' you would do the following  
type of operation
    set the customPropertySet of this stack to "cpsStatusCodes"
    put the customProperties of this stack into statusCodeList
    -- now make a regular list
    combine statusCodeList using cr and "^"
    set the itemdel to "^"
    if field "desiredCodeString"  is not empty then
       filter statusCodeList with "*" & field "desiredCodeString" & "*"
       --and now you have a list of cd id's
    end if

    if field "notnowCodeString"  is not empty then
       filter statusCodeList without "*" & field "notnowCodeString" &  
"*"
       -- and you have a shorter list if any have been removed
    end if
    -- if you want the card order, use the following
    sort statusCodeList numeric by item 2 of each
    put statusCodeList into fld "output"

    --this allows showing a list of hits and changing the final list  
in many ways
end doCustomPropertyRun

----------------------------------------
Jim Ault
Las Vegas






More information about the use-livecode mailing list