How do I declare, set & test a variable.

I've been using BTT for a couple of months now.
It has been very useful, but a few times I have wanted to use variables and not found out how.
Up to now I've been able to find ways around it, but I really need to know how variables work in BTT.

This documentation page talks of persistent variables, which I think must be what I need, but it does not say how to create & use them.
I have hunted around the UI - &
googled.

Any help with this obviously basic problem would be much appreciated.

Thank you

1 Like

best post a concrete example, then it'd be easier for me to describe what you need to do

how do I declare a variable.

a variable for what? if possible please post a concrete example. ( It probably won't help you much if I tell you use the predefined action "Assign / Set Value For Variable")

Set and get for variables can be done from either AppleScript or JavaScript.

The documentation pages for AppleScript and JavaScript:
https://docs.folivora.ai/docs/1106_java_script.html
https://docs.folivora.ai/docs/1102_apple_script.html

Both pages have sections for each scripting function, with examples of how to use the functions. Open one of these pages, and search for
"set_string_variable".

You do not need to declare a variable, but if you try to get a variable that has not yet been set, then its value will be undefined.

(It took me a while to find these when I wanted to figure out how to do it. It would be nice if doc page 1105 included a link into the relevant sections of 1106 and 1102)

It can also be done in various other ways and then it depends where you want to use them. That's why I'm asking for a concrete example of what should be achieved :slight_smile:

Thanks Andreas & Telephant

I think a single sentence in the documentation would be helpful.