BTT crashes when running async AppleScript

Describe the bug
If the action "Run AppleScript (async in background)" is assigned to any trigger, clicking "Run Script" in its configuration dialog immediately crashes BTT. It doesn't matter what the script is or if a script is entered at all – the button behaves like it is hard-wired to crash.

This does not happen with a blocking script (or after disabling the "run in background" option from the config dialog). Neither does it happen when running from the "Advanced Configuration" dialog of, for example, the Touch Bar "Run AppleScript" widget.

Also, if a valid script is entered and saved without running from the config dialog, the resulting trigger properly executes the AppleScript – no issues.

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):

Device information:

  • Type of Mac: 2017 MBP
  • macOS version: 10.13.5
  • BetterTouchTool version: 2.512

Additional information (e.g. StackTraces, related issues, screenshots, workarounds, etc.):
Let me know if a crash report is needed.

This doesn't seem to happen here, but maybe try upgrading to the latest alpha.

Crashes as well. Log attached.

BetterTouchTool_2018-06-15-183538_***.crash (75.1 KB)

Ah I think the script editor currently doesn't like empty returns.
Could you post an example Apple Script that crashes for you?

You're right. say "Hello" crashes, but return "1" does not. (And contrary to what I thought before, the AppleScript is executed in both cases; I could definitely hear a friendly voice saying "Hello" before BTT crashed. ;-))

Has been fixed, marking it as such. Thank you!

Hi. I just discovered the same thing.

Here is my Applescript which runs OK outside of BTT:

--Give time for admin login and Clipboard loading
delay 7

--Get clipboard value and set variable
set dly to (the clipboard) * 7

--Delay by variable amount
delay (dly)

--Quit Fake app
tell application "Fake"
end tell

Applescript is called from a gDrive volume as a file. I also tried putting the script in instead of running from a file but same result.

BTW BTT restarts itself after a while.

I'm not sure what you're trying to do here. When is this AppleScript run? Who sets the clipboard's contents prior to its execution?

Multiplying the the clipboard's contents times 7 will naturally only work if the contents are a number. If not, your set dly line will throw an error. Most likely that's what's causing your script to fail sometimes. (BTT doesn't seem to handle AppleScript errors very well and might simply crash if there is one.)

Perhaps you could generate your variable delay without the use of the clipboard (which is easily disturbed by events outside of your AppleScript)?

Thanks @Shnub, here's another post to give context :slightly_smiling_face: Set BTT delay by a variable amount

The Applescript is run as part of a BTT sequence which starts a workflow. Fake gets a value from a web page and puts it in the clipboard.

I tested that the clipboard was a number in case that was the reason and it was so it wasn't the reason for BTT hanging. Yes, I or something else using the clipboard could mess this up but it's unlikely as it's soon after I push a FN button so I don't think this will be an issue and certainly wasn't during my testing.

I tried non-async as well with the same result.

So, I did some more experimenting and it seems that, although they are not enabled, the BTT commands still get actioned. Once I deleted the ones I had temporarily de-enabled, everything seems to work fine. These commands must have been interfering somehow.

So, with the check-box next to an assigned action not ticked, shouldn't BTT not perform that action? Maybe this is a different bug? Or did I assume incorrectly?

Here is the working BTT sequence and Applescript:

I added Send cmd-H to Fake back in and it still all works OK. So I am telling Fake to Run and Hide! :grin: #NerdJoke