What variable should I use to show AppleScript result in HUD Overlay?

Hi,

I’m using BetterTouchTool and trying to display the result of a “Run Apple Script” action in “Show HUD Overlay”.

The Apple script returns a simple string like:

return "HELLO"

But I don’t know which variable to use in the HUD content.

I tried:
• {result}
• {last_returned_value}
• {return_value}
• {clipboard}

None of them work (they just show as plain text).

So my question is:
What is the correct variable to access the result of the previous action in BTT?

Thanks

I think you need to use set_persistent_string_variable or set_string_variable something like:

set resultText to "HELLO"

tell application "BetterTouchTool" to set_string_variable "$myVar" to "$resultText"

And then use $myVar in BTT

Correct, setting a variable in your script is the best option.

This feels like it would be a useful feature for prototyping/debugging:
I imagine something like this: BTT stores the return value from the last script execution in a BTT var.
(Something like $? in zsh)
Then in order to debug a script issue, you just add a HUD action that shows that variable.
Bonus utility:

  1. You could use the value for conditional execution of following actions, and
  2. You could use the value in a following script, allowing a form of script chaining.

All of this is possible now by storing the value in a BTT variable, but this would make it much easier.