Scripting variables screen

Hallo Andreas,
that new screen is great in the new BTT version !
I like the float on top !

one additional feature you might want to consider. If you add a tickbox in front of each row of the varibale it could be used to filter out multiple variables (when multiple are ticked, like play and midi_note in my example screen).

In many situations we might want to monitor multiple variables, which could not be archieved with the search function...

really helpful addition @Andreas_Hegenberg !

1 Like

good idea, I’ll add a button to pin variables!

wow!!

great new window!!! thanks a lot!!!

I have added a pin button to the variables with 5.376

Polling the "On demand" variables is disabled by default now because that uses a lot of CPU for some of them.

2 Likes

Hi @Andreas_Hegenberg, thank you for the new Variables & Scripting window. I have a few suggestions to improve its usability:


  1. Window Name Is the official title of this pane ā€œScripting Settingsā€, or something else? A clear, consistent name helps with documentation and user support.

  1. Titlebar UX
  • Issue:
    • On Scripting (General), the titlebar is shorter and the label is centered, whereas on Variables, AppleScript, and JavaScript it’s taller and left-aligned (to make room for the search field).
  • Impact:
    • Switching between tabs causes a noticeable ā€œjump,ā€ which feels jarring.
  • Suggestion:
    • Always reserve the same height and alignment space for the search input, even if it’s disabled, so the titlebars never shift.

  1. Sidebar Hierarchy
  • Issue:
    • All four sidebar items are equal-weight, so it’s not obvious that Scripting (General) is actually the ā€œglobal settingsā€ for this pane.
  • Impact:
    • I had to click around and experiment to understand the hierarchy.
  • Suggestion:
    • Group Scripting (General) into its own section (e.g. ā€œSettingsā€) or move it above/below the tab list, so it doesn’t feel like just another scripting category.

  1. Missing AppleScript Interfaces – I’ve compared the AppleScript list against BetterTouchTool.sdef and found some commands that aren’t shown in the UI. Would you consider exposing them for feature-parity?
  • chat_gpt
  • display_notification
  • get_active_touch_bar_group
  • get_location
  • get_menubar_menuitem_details
  • get_weather
  • is_app_running
  • is_true_tone_enabled
  • run_shortcut

  1. Add JXA (JavaScript for Automation) Support – Please add a JXA tab alongside AppleScript. Many users (myself included) prefer JXA’s syntax, and it keeps parity with the existing JavaScript UI.

  1. Rename ā€œJava Scriptā€ Tab – The label Java Script sits right after AppleScript, which led me to think it was JXA. Consider renaming it to something like ā€œBTT JavaScriptā€ or ā€œJS (BTT)ā€ to distinguish it from JXA.

  1. Consolidated Scripting Mental Model
    • Problem:
      • It’s hard to see how these scripting flavors differ and where to start:
        1. AppleScript (classic macOS automation)
        2. JXA (JavaScript for Automation)
        3. BTT JavaScript (Node-style, BTT-specific API)
    • Impact:
      • Even advanced users can be unsure which API to choose and docs are scattered across:
        • Scripting BTT
        • Using Real Java Script in BTT
        • Scripting BetterTouchTool using Apple Script
        • Custom Scriptable WebView
        • Scripting Floating Menus
        • HTTP Requests / Webserver
        • Custom URL Scheme**
    • Suggestion:
      • In the new pane, provide:
        1. A concise description of the scripting interface and when and where to use it.
        2. Add syntax code highlighting the example snippets
        3. Display a "copy to clipboard" button on hover for the example snippets

Thank you for considering these ideas, I’m excited to see how Variables & Scripting evolves!

2 Likes

@Andreas_Hegenberg does the get_weather Scripting Interface still work? I used it somewhat recently but ended up using a different API. Now when I try to use get_weather, I get an empty response.

osascript -e 'tell application "BetterTouchTool" to get_weather "48.1351,11.5820"
{

}

oops, my token expired just tonight. Will fix it now.
//edit: weather should be working again! Might require a BTT restart.

I agree with all your points! The view started just as an experiment (on how much SwiftUI code I can auto-generate with AI). Now I want to make it the base for all scripting info, I also want to add a way to make it easier to directly test scripting stuff from within that, but this might need to wait a bit.

1 Like

Hi @Andreas_Hegenberg,
for me the new screen makes it so much easier to follow what is going on, it is a much better experience...

Suggestion:
could you perhaps "pin" the new variables screen below or even better,
make it "part" of the main BTT window, like in the example below.

That would make it come up again once the main configuration window was closed and reopened...

or as alternative

add an action to open/close it (as floating window) ?

// edit: almost forgot this:

Thx,
Christian

1 Like

Thanks! I confirm get_weather works again on BTT v5.378!

Sounds great!

Hi @Andreas_Hegenberg , previously I was able to copy all vars easily, is there some "workaround" with the new screen? I'm aware of the file ~/Library/Application Support/BetterTouchTool/btt_user_variables.plist, but as the name suggests there are only the user's vars. I've tried to grep 'BTTNowPlayingInfoSequoia in various directories, but without a luck.

good idea, Iā€˜ll add a copy all function

added a "Copy All Variables" button in 5.389

2 Likes

Hallo Andreas,

there are sections/lists in BTT where a 'sort' would be a big improvement as well..
This makes a hell of a difference if the lists are very large.

Like the new "Copy all variable" function (output is not sorted) or "BTT On demand" vars list.

thx, Christian

Hallo @Andreas_Hegenberg

some more suggestions for later, related to variables types (string/number/..)

a var type indicator of some sort could be added

the copy function should copy the string vars as
"midi_note": "60"

Thx,
Christian

Hallo @Andreas_Hegenberg,

wonderful !
all of the above suggestions are now already available in v5.391!

Thx,
Christian

I would like to propose three changes for the Scripting variables window:

INDEPENDENCE
This window is very very very very useful. But the process for open it it's a little bit slow. I would prefer to opening it directly without opening the Settings window. So I ask for:

  • add one item in the menubar for opening the scripting variables window (alone)
  • one action in the actions list for opening the scripting variables window (alone)
  • keep the Settings as they are now, so we could also open it from the Settings window

TRIGGER_NAMED
It would be great to have a new tab in the sidebar to list all trigger_named, sorted by name A-Z, with a search bar too.
In a second step, it would be very handy to have a "select from the list" button in the trigger_named action that would open this window but with a "use selected" button added.

SORTING OF VARIABLES
It would be very handy to sort also the variables by the value. This would be useful to list the variables that are false (0) first, then the ones that are true (1), after higher numbers, and finally the strings.


Finally, I have found two issues:

  1. I have to click twice the sort buttons in the Variables window to activate the sorting. i.e I have to click twice the button "Persistent first" to list the persistent vars first. In other words, the first click highlights the button, the second click sorts the list.

  2. When selecting the "JXA - JavaScript for Automation" the title of the window is "AppleScript API"

1 Like

yes, those would be very nice
and perhaps a shortcut like (Opt+Cmd+L) or what ever.

then I can retire my ugly workaround...:grinning_face_with_smiling_eyes:

5.392 adds an action for this, also fixed selection persistence and added sort by value

2 Likes

5.392 is perfect, sort by value is a nice addition IMHO.

The title of the "JXA - JavaScript for Automation" section is still "AppleScript API". Is that correct?