Apple Script Help: Check if an app is running [HazeOver]

basically im making a button to toggle hazeover on and off, using an apple script widget:

tell application "BetterTouchTool"
    if is_app_running "HazeOver" then
		return " "
		return ""
	end if
end tell

but the alternate icon isnt working. am i doing somehting wrong?

That's not a bug of BTT but your script :sweat_smile: run it in the Apple Script Editor and you should get an error message with the exact location.

Try this one

if application "HazeOver" is running then
    return " "
   return ""
end if

Edit: I moved your thread to a more suitable section.
If you just search for the state of the app (running or not? Active or not?), there is no use at all to call BetterTouchTool. This can be done through the standard command lines from my post above.

Hint: try new scripts inside the mentioned Script Editor. It will show you where errors are, and through the dictionary (find it in the menu bar) you'll find all commands that can be given to all the apps you have.
System commands can easily be found through DuckDuckGo/Google/... :ok_hand:t4:


weird that the script is broken, considering a c+p'd it from @GoldenChaos

used your code. the icon still wouldnt change...

Ah… Did you adjust the regex?

what's that lol

Widget specific settings, Alternate Color Regex. If the output of your script equals what you put in there, then the alternative icon/color will be displayed by BetterTouchTool.
So if your standard icon is "HazeOver = quit" and your second icon is "HazeOver = running", then put a space as the regex.
To be more clear use this script:

if application "HazeOver" is running then
    return "Open"
   return "Quit"
end if

If your standard widget icon (the first one if you want) is the running icon, put in the line below Regex "Quit" to display the alternate Icon for the app being quit. If your widget icon is the quit symbol, put "Open" in the Regex line to display your alternate icon, being the one for the running app.

like this? it didn't work..

Attention with the 0 and the O, is the app name correct?

yup, font is just different in the code. it is the letter O

should 'always run...' be ticked?

Hm. What does the script editor return if you run the script in it?

This will just refresh the widget as soon as it is displayed on the Touch Bar.

And what does happen if you run it in BTT, the result is the same?

yep, but without the " "

And the icon settings are what? Alternate icon being the one if the app is quit?


I'm lost. Then now it displays correctly the icon of the app as running?