# \#scripting

**URL:** https://community.folivora.ai/tag/scripting/32.md

[Latest](https://community.folivora.ai/latest.md) · [Categories](https://community.folivora.ai/categories.md) · [Tags](https://community.folivora.ai/tags.md)

---

## [Activate Specific Window by Window id/number](https://community.folivora.ai/t/activate-specific-window-by-window-id-number/46678)

<div class="topic-metadata">

**Author:** [@santip](https://community.folivora.ai/u/santip)\
**Replies:** 6\
**Last updated:** [October 23, 2026, 9:44am UTC](https://community.folivora.ai/t/activate-specific-window-by-window-id-number/46678 "2026-10-23T09:44:25Z")

</div>

I’d like to use the “Activate Specific Window” action (or some equivalent of it) but instead of targeting the window by title/app I want to use the window id. BTT exposes a global variable BTTActiveWindowNumber, and in t…

---

## [Request for BetterTouchTool Preset Format Documentation](https://community.folivora.ai/t/request-for-bettertouchtool-preset-format-documentation/43480)

<div class="topic-metadata">

**Author:** [@Tobias\_Hochgurtel](https://community.folivora.ai/u/Tobias_Hochgurtel)\
**Replies:** 5\
**Last updated:** [April 24, 2026, 7:49am UTC](https://community.folivora.ai/t/request-for-bettertouchtool-preset-format-documentation/43480 "2026-04-24T07:49:12Z")

</div>

Hello Andreas (or BetterTouchTool team), I'm working on a developer tooling project that aims to programmatically create and manage BetterTouchTool presets. After examining exported .bttpreset files, I can see they use …

---

## [Lag with analyzeDeviceInput on Wacom Intuos (reportID filtering not enough)](https://community.folivora.ai/t/lag-with-analyzedeviceinput-on-wacom-intuos-reportid-filtering-not-enough/46658)

<div class="topic-metadata">

**Author:** [@cksachdev](https://community.folivora.ai/u/cksachdev)\
**Replies:** 0\
**Last updated:** [April 3, 2026, 7:54pm UTC](https://community.folivora.ai/t/lag-with-analyzedeviceinput-on-wacom-intuos-reportid-filtering-not-enough/46658 "2026-04-03T19:54:17Z")

</div>

I’m using a Wacom Intuos PTH-651 and have implemented custom ExpressKey handling via analyzeDeviceInput to map HID reports to BTT triggers. The parsing logic works correctly (I’m decoding key states from specific bytes a…

---

## [Why does this Run Real JavaScript cause BTT to crash?](https://community.folivora.ai/t/why-does-this-run-real-javascript-cause-btt-to-crash/45834)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 2\
**Last updated:** [December 23, 2025, 11:57am UTC](https://community.folivora.ai/t/why-does-this-run-real-javascript-cause-btt-to-crash/45834 "2025-12-23T11:57:57Z")

</div>

Describe the bug Setup this Trigger & Action combination: TipTap Left (1 Finger Fix) + Run Real JavaScript: \[ { "BTTLastUpdatedAt" : 1766359492.828398, "BTTTriggerType" : 113, "BTTTriggerTypeDescriptionRe…

---

## [Calling \`get\_keychain\_item\` within Floating WebView/HTML Menu](https://community.folivora.ai/t/calling-get-keychain-item-within-floating-webview-html-menu/45753)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 2\
**Last updated:** [December 11, 2025, 11:17pm UTC](https://community.folivora.ai/t/calling-get-keychain-item-within-floating-webview-html-menu/45753 "2025-12-11T23:17:22Z")

</div>

I'm created a Floating WebView/HTML Menu to display weather information. I want to call the weather API (https://api.weatherapi.com) without storing my API Key in plain text in the file. I thought of using get\_keychain\_i…

---

## [Periodically getting "shared secret" dialogs and I don't know why](https://community.folivora.ai/t/periodically-getting-shared-secret-dialogs-and-i-dont-know-why/44923)

<div class="topic-metadata">

**Author:** [@insanityfarm](https://community.folivora.ai/u/insanityfarm)\
**Replies:** 2\
**Last updated:** [August 29, 2025, 2:51pm UTC](https://community.folivora.ai/t/periodically-getting-shared-secret-dialogs-and-i-dont-know-why/44923 "2025-08-29T14:51:37Z")

</div>

Every couple days or so this dialog pops up: I think it's likely one of my own automations misbehaving rather than a legitimate security threat, but I don't know how to troubleshoot it. It appears at unexpected times…

---

## [returnToBTT() 's resulting variable name in BTT macro should be documented more clearly](https://community.folivora.ai/t/returntobtt-s-resulting-variable-name-in-btt-macro-should-be-documented-more-clearly/44844)

<div class="topic-metadata">

**Author:** [@sm1ng](https://community.folivora.ai/u/sm1ng)\
**Replies:** 1\
**Last updated:** [August 26, 2025, 8:21am UTC](https://community.folivora.ai/t/returntobtt-s-resulting-variable-name-in-btt-macro-should-be-documented-more-clearly/44844 "2025-08-26T08:21:03Z")

</div>

Hi there, I'm a reasonably experienced BTT user and yet I have to dig for well over half an hour before I found a page that mentioned that the results of the execute JavaScript action is accessible in BTT scripts as {res…

---

## [Pause all media apps](https://community.folivora.ai/t/pause-all-media-apps/43970)

<div class="topic-metadata">

**Author:** [@YGS](https://community.folivora.ai/u/YGS)\
**Replies:** 6\
**Last updated:** [June 8, 2025, 8:34am UTC](https://community.folivora.ai/t/pause-all-media-apps/43970 "2025-06-08T08:34:05Z")

</div>

Hi There, I want to be able to "just pause" several media playing at once from say 5 apps. Not toggle. So I can't just send Space to those apps. Just pause them. Is that possible? Example - Spotify, Chrome, Plex etc. A…

---

## [Dynamically set Focus Mode based on variable/user input](https://community.folivora.ai/t/dynamically-set-focus-mode-based-on-variable-user-input/43705)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 2\
**Last updated:** [May 20, 2025, 8:50am UTC](https://community.folivora.ai/t/dynamically-set-focus-mode-based-on-variable-user-input/43705 "2025-05-20T08:50:27Z")

</div>

Description of what you are sharing Problem I want to be able to set my current Focus Mode dynamically based on user input. e.g. shortcuts run "Set\_Focus\_Mode" \<\<\< "Work" shortcuts run "Set\_Focus\_Mode" \<\<\< "Reduce Inter…

---

## [Unexpected behavior – calling \`get\_location\` outputs old location](https://community.folivora.ai/t/unexpected-behavior-calling-get-location-outputs-old-location/43173)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 0\
**Last updated:** [April 7, 2025, 7:32pm UTC](https://community.folivora.ai/t/unexpected-behavior-calling-get-location-outputs-old-location/43173 "2025-04-07T19:32:16Z")

</div>

Describe the bug Today I traveled roughly 370 km by car between two European cities (both in the same timezone). I use a JXA script to obtain my current latitude and longitude, which are then used to display my location…

---

## [Hovered UI AX value as a Variable?](https://community.folivora.ai/t/hovered-ui-ax-value-as-a-variable/42722)

<div class="topic-metadata">

**Author:** [@frankmak](https://community.folivora.ai/u/frankmak)\
**Replies:** 2\
**Last updated:** [March 8, 2025, 7:35pm UTC](https://community.folivora.ai/t/hovered-ui-ax-value-as-a-variable/42722 "2025-03-08T19:35:46Z")

</div>

I have been slightly losing my mind trying to figure this out so I would REALLY appreciate any help :pray: As the title suggests, I want to grab a Hover UI Element value, specifically the "AXTitle" value, so I can use t…

---

## [Inconsistent variable behavior when switching variable between string, number, persistent\_string, and persistent\_number](https://community.folivora.ai/t/inconsistent-variable-behavior-when-switching-variable-between-string-number-persistent-string-and-persistent-number/42707)

<div class="topic-metadata">

**Author:** [@pure\_pacific](https://community.folivora.ai/u/pure_pacific)\
**Replies:** 0\
**Last updated:** [March 6, 2025, 10:41pm UTC](https://community.folivora.ai/t/inconsistent-variable-behavior-when-switching-variable-between-string-number-persistent-string-and-persistent-number/42707 "2025-03-06T22:41:15Z")

</div>

Variable behavior is not consistent when using the same variable name for different permutations of set\_string\_variable, set\_number\_variable, and their persistent variations. It is easiest to show this via JXA (use the R…

---

## [AppleScript: \`reveal\_element\_in\_ui\` does not accept \`shared\_secret\`](https://community.folivora.ai/t/applescript-reveal-element-in-ui-does-not-accept-shared-secret/42662)

<div class="topic-metadata">

**Author:** [@pure\_pacific](https://community.folivora.ai/u/pure_pacific)\
**Replies:** 1\
**Last updated:** [March 4, 2025, 10:44am UTC](https://community.folivora.ai/t/applescript-reveal-element-in-ui-does-not-accept-shared-secret/42662 "2025-03-04T10:44:26Z")

</div>

Describe the bug reveal\_element\_in\_ui does not accept shared\_secret as a parameter. If a secret is set, the AppleScript fails when shared\_secret is included and prompts for secret when shared\_secret is omitted. Ideally,…

---

## [Best Practices for Securely Storing API Keys & Passwords in BTT Scripts](https://community.folivora.ai/t/best-practices-for-securely-storing-api-keys-passwords-in-btt-scripts/42420)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 10\
**Last updated:** [February 20, 2025, 11:05am UTC](https://community.folivora.ai/t/best-practices-for-securely-storing-api-keys-passwords-in-btt-scripts/42420 "2025-02-20T11:05:40Z")

</div>

Hello BTT Community, I frequently use BetterTouchTool’s scripting actions—Run Real JavaScript, Run JavaScript for Automation, and Run AppleScript—and they’ve been incredibly powerful. However, I haven’t found any inform…

---

## [Calling \`reveal\_element\_in\_ui\` for Triggers in All Apps doesn't work](https://community.folivora.ai/t/calling-reveal-element-in-ui-for-triggers-in-all-apps-doesnt-work/42099)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 2\
**Last updated:** [February 6, 2025, 10:51am UTC](https://community.folivora.ai/t/calling-reveal-element-in-ui-for-triggers-in-all-apps-doesnt-work/42099 "2025-02-06T10:51:00Z")

</div>

Describe the bug Calling tell application "BetterTouchTool" to reveal\_element\_in\_ui "\[...\]" doesn't work if the Trigger UUID is in "For All Apps" i.e. global. It does work if the Trigger associated with an app or CAG. I…

---

## [BTT crashes when calling \`get\_triggers\`](https://community.folivora.ai/t/btt-crashes-when-calling-get-triggers/42100)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 11\
**Last updated:** [February 6, 2025, 9:59am UTC](https://community.folivora.ai/t/btt-crashes-when-calling-get-triggers/42100 "2025-02-06T09:59:48Z")

</div>

Describe the bug I'm trying to obtain a list of all Triggers I've created in BTT by running this command in my terminal: osascript -e 'tell application "BetterTouchTool" to get\_triggers' When I run the command, BTT cr…

---

## [Need help automatically hiding dock with a specific app is active](https://community.folivora.ai/t/need-help-automatically-hiding-dock-with-a-specific-app-is-active/40962)

<div class="topic-metadata">

**Author:** [@Katiqee](https://community.folivora.ai/u/Katiqee)\
**Replies:** 1\
**Last updated:** [December 9, 2024, 9:23pm UTC](https://community.folivora.ai/t/need-help-automatically-hiding-dock-with-a-specific-app-is-active/40962 "2024-12-09T21:23:33Z")

</div>

What I'm wanting to do is have the dock hide when I am using after effects. When I got to another app I want the dock to automatically show again. I am confused how to run this and would really appreciate the help. …

---

## [Keyboard-centric: Copying / Moving Files in Finder "List" View Using only the Keyboard](https://community.folivora.ai/t/keyboard-centric-copying-moving-files-in-finder-list-view-using-only-the-keyboard/40414)

<div class="topic-metadata">

**Author:** [@proactivematter](https://community.folivora.ai/u/proactivematter)\
**Replies:** 0\
**Last updated:** [November 20, 2024, 5:44pm UTC](https://community.folivora.ai/t/keyboard-centric-copying-moving-files-in-finder-list-view-using-only-the-keyboard/40414 "2024-11-20T17:44:47Z")

</div>

Hey all, I use Finder exclusively in List view and enjoy the ability to toggle nested folders without having to actually enter said folders. With a mouse, this makes it possible to move files around without having to ju…

---

## [Add seperator to "Show Custom Context Menu (NEW)" and more details wanted](https://community.folivora.ai/t/add-seperator-to-show-custom-context-menu-new-and-more-details-wanted/39876)

<div class="topic-metadata">

**Author:** [@deflectn](https://community.folivora.ai/u/deflectn)\
**Replies:** 7\
**Last updated:** [October 25, 2024, 7:06am UTC](https://community.folivora.ai/t/add-seperator-to-show-custom-context-menu-new-and-more-details-wanted/39876 "2024-10-25T07:06:51Z")

</div>

Could we get a bit more informations about Simple JSON Format and BTTActions like a properly JSDoc or at least a type definition. I was trying hard to insert a seperator to my custom menu :sweat\_smile:. If someone else i…

---

## [Open-in-Terminal from desktop and some other bugs ?](https://community.folivora.ai/t/open-in-terminal-from-desktop-and-some-other-bugs/39171)

<div class="topic-metadata">

**Author:** [@sunnysigara](https://community.folivora.ai/u/sunnysigara)\
**Replies:** 1\
**Last updated:** [September 15, 2024, 1:45pm UTC](https://community.folivora.ai/t/open-in-terminal-from-desktop-and-some-other-bugs/39171 "2024-09-15T13:45:45Z")

</div>

BTT version: 4.639 MacOS: Ventura First BTT put a new line at the end of visible\_window\_list which is not easily discoverable from GUI. I only discovered it running javascript. And if you don't include the new line i…

---

## [Is it possible to programmatically create a new menu item in a Floating Menu?](https://community.folivora.ai/t/is-it-possible-to-programmatically-create-a-new-menu-item-in-a-floating-menu/39038)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 2\
**Last updated:** [September 5, 2024, 11:00am UTC](https://community.folivora.ai/t/is-it-possible-to-programmatically-create-a-new-menu-item-in-a-floating-menu/39038 "2024-09-05T11:00:45Z")

</div>

Is it possible to programmatically create new menu items within a Floating Menu through scripting, rather than manually adding them in the GUI? I haven't found any method to do this in the documentation or the Community. …

---

## [Displaying results of shell script](https://community.folivora.ai/t/displaying-results-of-shell-script/30023)

<div class="topic-metadata">

**Author:** [@rdr](https://community.folivora.ai/u/rdr)\
**Replies:** 7\
**Last updated:** [May 7, 2024, 11:56pm UTC](https://community.folivora.ai/t/displaying-results-of-shell-script/30023 "2024-05-07T23:56:25Z")

</div>

This subject came up a couple years ago but after searching more I don't see where it may have been resolved. I'd like to execute a shell script and capture its output for display in the HUD overlay. I can create a Str…

---

## [Scripting in BTT](https://community.folivora.ai/t/scripting-in-btt/35245)

<div class="topic-metadata">

**Author:** [@digger](https://community.folivora.ai/u/digger)\
**Replies:** 2\
**Last updated:** [January 15, 2024, 6:01am UTC](https://community.folivora.ai/t/scripting-in-btt/35245 "2024-01-15T06:01:43Z")

</div>

I'm doing some GUI scripting for work, does anyone have ideas on how to do a GUI if/then? there are some nodes in my workflow where I might get two different windows popping up, at which time I would like for my "wait …

---

## [Changing a Widget Identifier on return of script](https://community.folivora.ai/t/changing-a-widget-identifier-on-return-of-script/35012)

<div class="topic-metadata">

**Author:** [@PensivePhoenix](https://community.folivora.ai/u/PensivePhoenix)\
**Replies:** 0\
**Last updated:** [December 29, 2023, 1:51am UTC](https://community.folivora.ai/t/changing-a-widget-identifier-on-return-of-script/35012 "2023-12-29T01:51:30Z")

</div>

Trying to get a widget to change its button text on a TouchBar based on the return of its script, I am trying to get a javascript for automation script working where /-------------- var BetterTouchTool = Application('B…

---

## [Javascript console?](https://community.folivora.ai/t/javascript-console/32875)

<div class="topic-metadata">

**Author:** [@asp55](https://community.folivora.ai/u/asp55)\
**Replies:** 2\
**Last updated:** [August 23, 2023, 4:18pm UTC](https://community.folivora.ai/t/javascript-console/32875 "2023-08-23T16:18:17Z")

</div>

Feel like I'm missing something obvious, but is there a way to see the output of console.log() commands in BTT?

---

## [What does "Create isolated new context for script execution" do in "Run Real JavaScript" action?](https://community.folivora.ai/t/what-does-create-isolated-new-context-for-script-execution-do-in-run-real-javascript-action/30307)

<div class="topic-metadata">

**Author:** [@fortred2](https://community.folivora.ai/u/fortred2)\
**Replies:** 6\
**Last updated:** [August 13, 2023, 9:45pm UTC](https://community.folivora.ai/t/what-does-create-isolated-new-context-for-script-execution-do-in-run-real-javascript-action/30307 "2023-08-13T21:45:45Z")

</div>

I'm trying to understand what the toggle setting "Create isolated new context for script execution" in the "Run Real JavaScript" action does. I haven't found anything mentioning it in the Docs or the Community Forum. S…

---

## [Take text output from script, take a conditional action](https://community.folivora.ai/t/take-text-output-from-script-take-a-conditional-action/32641)

<div class="topic-metadata">

**Author:** [@stevemac](https://community.folivora.ai/u/stevemac)\
**Replies:** 2\
**Last updated:** [August 7, 2023, 10:14pm UTC](https://community.folivora.ai/t/take-text-output-from-script-take-a-conditional-action/32641 "2023-08-07T22:14:29Z")

</div>

Hi All, I've tried to explore this myself in BTT and Shortcuts (not to mention several adventures down rabbit holes in stack overflow) however I'm still a bit stuck so was hoping someone could kindly provide a bit of gui…

---

## [Use specific (python / Anaconda) environments in Shell Script](https://community.folivora.ai/t/use-specific-python-anaconda-environments-in-shell-script/32645)

<div class="topic-metadata">

**Author:** [@lennarto](https://community.folivora.ai/u/lennarto)\
**Replies:** 2\
**Last updated:** [August 7, 2023, 1:19pm UTC](https://community.folivora.ai/t/use-specific-python-anaconda-environments-in-shell-script/32645 "2023-08-07T13:19:35Z")

</div>

Hi, I use Anaconda to work with python environments. Unfortunately, I am not able to trigger a python script from BTT :pensive: What I tried so far: Played with the Launch Path (bin/bash, bin/zsh, /Users/lto/anacond…

---

## [Disabling usage logging causes variables not to work](https://community.folivora.ai/t/disabling-usage-logging-causes-variables-not-to-work/31808)

<div class="topic-metadata">

**Author:** [@MattDev](https://community.folivora.ai/u/MattDev)\
**Replies:** 1\
**Last updated:** [June 6, 2023, 5:28pm UTC](https://community.folivora.ai/t/disabling-usage-logging-causes-variables-not-to-work/31808 "2023-06-06T17:28:19Z")

</div>

I couldn't figure out why a shortcut I had made previously was no longer working, and I finally realized that it was because the BTTLastTriggeredUUID variable no longer existed. After doing some more snooping, I eventua…

---

## [Touchbar Synced Lyric](https://community.folivora.ai/t/touchbar-synced-lyric/10498)

<div class="topic-metadata">

**Author:** [@maxen2019](https://community.folivora.ai/u/maxen2019)\
**Replies:** 28\
**Last updated:** [March 30, 2023, 1:34pm UTC](https://community.folivora.ai/t/touchbar-synced-lyric/10498 "2023-03-30T13:34:26Z")

</div>

I just implemented synced lyric on touchbar based on the idea of Kashi! Figured you might want this! Here is the github link: https://github.com/ChenghaoMou/touchbar-lyric In case you are wondering, I crawled a Chinese…

[Next page](https://community.folivora.ai/tag/scripting/32.md?match_all_tags=true&page=1&tags%5B%5D=scripting)
