Parsing the long ID or long Name

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Jul 26 18:47:18 EDT 2016


Trying to avoid reinventing the wheel here:

use Case:

1) you want to set a behavior to a common group to act on mouse events.
2) this group is present by different names (deliberately unique names) in different stacks
3) the behavior needs to act on the mouse event.

The obvious param to send to the behavior is the long ID or long Name of the target, or the owner of the target… or the owner of the owner of the target… 

image "portal-link-image" of group "listen_music" of group "listen-links" of card "listen-links" of stack "/Users/Brahmanathaswami/Documents/App-Development/SivaSivaAppWorking/_SivaSource/source/modules/listen/listen.livecode"

in this specific use case.. we the sub-info-param the behavior needs to act is "listen-music"

I'm curious if anyone has written a generic parser for turning the long ID or long Name of the target into an array?  I suppose some hacky trick like turning the word "of" into "|"  or tab and then splitting the string.. but I can't figure out how to split 

image "someQuotedObjectName

otherwise resort to old parsers like 

word 2 of the long name of the owner of the target… 
but this too is iffy because we can't assume that every name is a word.. the quoted string could have spaces…

it would be easier to check the keys of an array

# Owner name is our trigger
put the keys of tTargetName (an array) into sMouseTarget
switch sMouseTarget
   if "listen-music" is among the lines of sMouseTarget then 
      # load some other stack or go to some card

what do you do?

BR




More information about the use-livecode mailing list