How can I access the "selected_text" variable from Shell script?

The documentation only gives examples on how to retrieve the contents of a string variable in Apple Script and JavaScript.

What is the shell equivalent of:

tell application "BetterTouchTool"

    return get_string_variable "selected_text"

end tell

Use case:


Neither echo ${0} or echo ${selected_text} work?

Sorry the BTT internal variables are currently not available to shell scripts but I'll check if I can somehow make them available.

1 Like

Thanks for the update :call_me_hand:

I think a good solution is to allow the user to set a whitelist of internal BTT variables, and then just pass those as environment variables to the invoked script.

1 Like