JavaScript in a command


K.V.
16 Aug 2017, 20:56I think I need to be converting a string to an expression/value, because this doesn't work either...
Can a variable even be an expression (or a value)?
Command pattern:
request (#text#)
msg (text)
text = Split(text, ",")
msg (ListItem(text, 0))
text1 = (ListItem(text, 0))
msg (ListItem(text, 1))
text2 = (ListItem(text, 1))
request (text1, text2)
> request (Hide, "Panes")
Hide, "Panes"
Hide
"Panes"
Error running script: Requested value 'text1' was not found.
The Pixie
16 Aug 2017, 21:52For the first use
JS.eval(text)
The second will not work because the first parameter to request should not be s string. I am not sure what to call what it is but you cannot convert to it from a string.

K.V.
16 Aug 2017, 22:08Thanks, Pixie!

K.V.
18 Aug 2017, 06:30Got this one working (only for Show and Hide so far, but the remaining 21 cases will be added shortly (and yes: I've gone slightly insane)):
request (#text#)
text = Split(text, ",")
t1 = (StringListItem(text, 0))
t2 = (StringListItem(Split((StringListItem(Split((StringListItem(text, 1)), " "), 1)), "\""), 1))
msg (t2)
switch (t1) {
case ("Hide") {
request (Hide, t2)
}
case ("Show") {
request (Show, t2)
}
}

K.V.
18 Aug 2017, 06:39...now I need to learn the RegEx to check the formatting up front...
request (Text, "Text")
I don't need to do Update Location, Quit, Save, Pause, or Wait (unless I could check for those quotation marks, with or without anything in between them, but I don't know if that's too much for RegEx (but surely it's not)).