finding the name of the target's stack in a script

Peter M. Brigham pmbrig at gmail.com
Tue Jul 24 22:43:53 EDT 2012


On Jul 24, 2012, at 8:28 PM, Dr. Hawkins wrote:

> It seems, though, that there should be a construct along the lines of
> 
>  the stack of <object>
>  the card of <object>
>  the group of <objec>

I tried to find a way of doing this without "do" commands, but…

function stackOf tObjLongID
   replace " of " with numtochar(8) in tObjLongID
   set the itemdelimiter to numtochar(8)
   put item -1 of tObjLongID into tStack
   do "put the short name of " && tStack && "into stackName"
   return stackName
end stackOf

function cardOf tObjLongID
   replace " of " with numtochar(8) in tObjLongID
   set the itemdelimiter to numtochar(8)
   put item -2 to -1 of tObjLongID into tCard
   replace numtochar(8) with " of " in tCard
   do "put the short name of" && tCard && "into cdName"
   return cdName
end cardOf

function groupOf tObjLongID
   if " group " is not in tObjLongID then return empty
   replace " of " with numtochar(8) in tObjLongID
   set the itemdelimiter to numtochar(8)
   put item -3 to -1 of tObjLongID into tGp
   replace numtochar(8) with " of " in tGp
   do "put the short name of" && tGp && "into gpName"
   return gpName
end groupOf

Can't do "stack of…" but you can do "stackOf(tLongID)"

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list