Handling Long ID in Params?
Scott Rossi
scott at tactilemedia.com
Mon Oct 17 05:11:43 EDT 2011
Anybody know if there's a problem using long IDs or filenames within the
params sent to a command?
I'm trying work out a method of triggering private commands in a frontscript
using an open "routing" command -- a command that takes incoming commands
with parameters and forwards them to the private ones. Here's a simple
example that works for me (using a function to remove the outer quotes from
param values):
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
do theCommand && theArgs
end routeTheCommand
function stripOuterQuotes pStrings
repeat for each item theString in pStrings
put char 2 to -2 of theString & comma after temp
end repeat
delete last char of temp
return temp
end stripOuterQuotes
private command getTheSum p1,p2,p3
answer (p1+p2+p3)
end getTheSum
---
If I execute: routeTheCommand "getTheSum",1,2,3
I get "6" as expected.
Here's where I run into the problem. If I change getTheSum to a simple
answer routine:
private command getTheSum p1,p2,p3
answer p1
end getTheSum
...and include the long id of a control in the command sent to the routing
handler:
put long id of btn 1 into aLongID
routeTheCommand "getTheSum",aLongID
Then "getTheSum" answers empty, instead of the button's long id. If I test
the "theArgs" param within the routeTheCommand handler, it contains the
button's long id, but apparently "getTheSum" is not getting this value.
---
Maybe this isn't the best method to accomplish what I need, but can anyone
see why this is failing?
Thanks & Regards,
Scott Rossi
Creative Director
Tactile Media, UX Design
More information about the use-livecode
mailing list