1

I want to do this:

Send "MenuPick " & quote & ShortForm & quote to stack "Abbrevs"

The stack "Abbrevs" has a handler MenuPick that does the usual menu-picking thing. This works fine except for a ShortForm argument that has an embedded quote.

How can I send an argument with an embedded double-quote?

These don't work:

  • Quoting the string again
  • Changing the quote to two quotes
  • Escaping the quote with a backslash
D-Coder
  • 11
  • 3

2 Answers2

0

Okay, I struggled with this some more and found that the arg can be evaluated during the Send like this:

Put "Send " & quote & "MenuPick ShortForm" \
        & quote & " to stack " & quote & "Abbrevs" \
        & quote into MyCmd
Do MyCmd
D-Coder
  • 11
  • 3
  • What you have done here is create the statement `send "MenuPick ShortForm" to stack "Abbrevs"` inside the variable `MyCmd`, then used the `do` command to execute the statement in the variable. It's an unnecessary step requiring extra processing overhead. – Devin Apr 03 '20 at 04:51
0

Assuming you want to send the literal string "ShortForm", with quotes, as a parameter with the message, try putting the quoted string into a variable first.

put quote & "ShortForm" & quote into tPick
send "menuPick tPick" to stack "Abbrevs"
Devin
  • 593
  • 1
  • 3
  • 8
  • Nope, I wanted to send the contents of the variable named ShortForm, which include a quote. – D-Coder Apr 02 '20 at 03:07
  • Assuming thevariable `shortForm` contains your quotes, `send "menuPick ShortForm" to stack "Abbrevs"` should work for you. – Devin Apr 03 '20 at 04:48