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.

1 Like

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!

@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