Very interesting. Apparently the system function BTT uses wasn't able to translate the key code, in which case it returns 0, which is the code for "A"
Did you change your keyboard layouts after recording that shortcut?
Very interesting. Apparently the system function BTT uses wasn't able to translate the key code, in which case it returns 0, which is the code for "A"
Did you change your keyboard layouts after recording that shortcut?
I was using a Windows mechanical keyboard.
I don't remember If I've used it to record the shortcut.
I've found what appears to be an issue with Standard floating menu items and Real JavaScript. It seems that currently the only way to run JavaScript in this context is to use an async function.
When I use the default JavaScript below, it outputs correctly in the "Script Result" box.
returnToBTT('please return a string like this somewhere in your script');
However, as soon as I actually use the script via any of the Execute/Run options the menu item always says:
TypeError: undefined is not an object
There are no errors reported in the BetterTouchTool JavaScript Runner console when this happens.
If I change the script configuration to the following, everything works fine:
async function test() {
return 'please return a string like this somewhere in your script';
}
Async function to call (optional): test
I'm not sure what the intended behavior of JavaScript with floating menu items is, so I don't know whether this is a bug or just UI that hasn't been updated yet.
That's a general case for all of BTT, every JS code executed needs to be in a async wrapper at least.
So your first example would work like this:
(async () => {
returnToBTT('please return a string like this somewhere in your script');
})();
Makes sense! It would be helpful if the boilerplate JavaScript could be updated to reflect this so other people don't get confused like me. ![]()
I replied before I actually tested. Whoops! When switch to an async wrapper and remove the "Async function to call" setting, I still get TypeError: undefined is not an object as the menu item text. This is using the test code:
Let me know if you need more information to help troubleshoot this.
That's weird, where are you running this exactly? Possibly post a screenshot.
To isolate the issue, I created a new Floating Menu and a single Standard Item. Everything is default other than enabling Scripts, changing the type to Real JavaScript, and pasting in the test code. As soon as I check Run On First Load, the text of the menu item changes to the error.
I just double-checked to make sure I'm on the latest version and I have 4.214 (2435).
Ah that's a bug, thanks for reporting!
You can either change the script to
async function itemScript(itemUUID) {
return "hello world";
}
Or use the new alpha (4.220, it's currently uploading).
Thanks for the quick fix! Also, thanks for Floating Menus. I was able to convert a custom WebView into a Floating Menu pretty quickly and simplify things in the process. ![]()
After the recent Alpha Updates, I had some problems with the Chat GPT Action, It doesn't work in the custom context menu, and when triggered from a floating menu, BTT Crashes...
BTT 4.225
thanks for reporting, will look into it!
Should be fixed in 4.226 alpha (will be available in 10 min)
It works!
Thanks ![]()
BTT Kept prompting me for a new update (5 times I think).
Prompt #4
Prompt #5
Same Update over and over...
it's a bug in the new Xcode, doesn't update the build number correctly in some situations...
I'll add a manual step to prevent this.
Amazing!
I was typing when I discovred the "Display Order (Advanced)".
It's very useful, especially that I'm using app specific elements that I don't want to affect the general elements' order.
Amazing ![]()
It's a standard BTT variable that can be accessed via scripting. Some actions also support using the variables, for example the new if conditions - e.g. to trigger different things depending on your input: Control Action Sequence Flow ยท GitBook
HUDs can display the variable content if you put it in curly braces {variable_name}
Via scripts you can access them using the standard get_string_variable and get_number_variable functions:
http://docs.folivora.ai/docs/1101_scripting_btt.html
Then you can also pass it to other scripts etc.