Applescript code runs fine from Script Editor but locks up BTT UI when used within a trigger action

Describe the bug

The following Applescript runs fine from Script Editor but causes the spinning beachball when run from a BTT Run Applescript (blocking) action:

property webviewTitle : "dynamicList"

tell application "System Events" to tell process "BetterTouchTool"
	set wins to (windows whose title is "" and subrole is not "AXSystemFloatingWindow")
	repeat with win in wins
		set found to (first UI element whose description is webviewTitle) of scroll area 1 of group 1 of win
		if (found is not missing value) then return 1
	end repeat
	return 0
end tell

Within BTT it does run ok if changed to async / background, but obviously can't then be used to determine a condition for other Run Javascript or Run Applescript actions or within webviews.

Device information:

  • Type of Mac: mb air m1
  • macOS version: 12.5.1
  • BetterTouchTool version: 4.060

Additional information (e.g. StackTraces, related issues, screenshots, workarounds, etc.):

I'd really like to be able to use this code to determine the existence of a specific webview on-screen, although ideally the issue above could be rendered moot by the implementation of this feature request. I don't know if the fact that this script succeeds in Script Editor but fails in BTT is indicative of some deeper issue with my BTT / Applescript setup, or just some random ghost in the machine.

Unfortunately there is not much I can do to fix this as far as I know it's an Apple Script limitation with BTT's architecture (querying itself).

But maybe the info I provided in the other thread can help

Just saw that, thanks. I figured it might just be one of those Apple-ish idiosyncrasies :+1:.