Hi Scott, I'm sure you have good reasons but I'm curious about why you would want to classify a handler as private if you know you will need to access it from outside the script that it's in? Pete Molly's Revenge <http://www.mollysrevenge.com>
On Mon, Oct 17, 2011 at 10:30 AM, Scott Rossi <sc...@tactilemedia.com>wrote: > Thanks Ken, you got me on the right path. I lost so many hours on this > dumb > thing, but I think it's a valid concept worth using. > > Again, the idea is to be able to execute any private command of a script > using a single "router" command, with any number of parameters. The > caveat, > as Ken pointed out, is that long object ids need to include "long id of" > when used as parameters. The code is simplified below: > > command runPrivateCommand pCommand > put item 2 to -1 of (word 2 to -1 of the params) into commandParams > repeat for each item theString in commandParams > -- strip outer quotes of params > put char 2 to -2 of theString & comma after theArgs > end repeat > delete last char of theArgs -- strip trailing comma > do pCommand && theArgs > end runPrivateCommand > > So, as a simple example, if a script has a private command: > > private command getObjectID pObj > answer the id of pObj > end getObjectID > > ...this command can be triggered by any external object via the above > router > command (in the same script) with something like this: > > runPrivateCommand "getObjectID","long id of" && long id of btn 1 > > > > Thanks again Ken. > > Regards, > > Scott Rossi > Creative Director > Tactile Media, UX Design > > > > > Recently, Ken Ray wrote: > > > On Oct 17, 2011, at 4:11 AM, Scott Rossi wrote: > >> > >> Maybe this isn't the best method to accomplish what I need, but can > anyone > >> see why this is failing? > > > > Scott, when you execute the "do", it's getting the text of the button and > > passing that along instead of the long id that's coming into > > "routeTheCommand". To make it not evaluate it, call: > > > > routeTheCommand "getTheSum","the long id of btn 1" -- put quotes around > the > > second param > > > > The other way you could do it would be to insert "the long id of " before > > theArgs if you knew it was an object reference that was coming in: > > > > command routeTheCommand > > put word 2 to -1 of the params into commandData > > put stripOuterQuotes(item 1 of commandData) into theCommand > > put stripOuterQuotes(item 2 to -1 of commandData) into theArgs > > put "the long id of " before theArgs > > do theCommand && theArgs > > end routeTheCommand > > > > Funky, but it worksÅ > > > > :D > > > > Ken Ray > > Sons of Thunder Software, Inc. > > Email: k...@sonsothunder.com > > Web Site: http://www.sonsothunder.com/ > > > > _______________________________________________ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > subscription > > preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode