Select finder only script started to throw an error 1799

tell application "Finder"
   activate
   set visible of every process whose visible is true and name is not "Finder" to false
end tell

Used this for years and all of a sudden it starts to throw an error. Does anybody know how to fix this?

The error messages is:

tell application "Finder"
	activate
	set visible of every process whose visible = true and name ≠ "Finder" to false
		--> error number -1799
end tell
tell application "System Events"
	set visible of every process whose visible = true and name ≠ "Finder" to false
end tell

I am using OS10.13 btw

Are you sure that this “non fatal error” is new ?

Here, running :

tell application "Finder"
	activate
	set visible of every process whose visible is true and name is not "Finder" to false
	display dialog "Here I am"
end tell

I get:


--Don't click, here is just an history.
tell application "Finder"
	activate
	set visible of every process whose visible = true and name ≠ "Finder" to false
		--> error number -1799
end tell
tell application "System Events"
	set visible of every process whose visible = true and name ≠ "Finder" to false
end tell
tell application "Finder"
	display dialog "Here I am"
		--> {button returned:"OK"}
end tell
Résultat :
{button returned:"OK"}

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 23 novembre 2020 08:44:47

Running your script, I get the same error massage.

and I started to look at it as the script threw a apple event timeout message this morning within seconds of running.

Apparently, this error has been thrown out just as long ago. On Catalina too, I checked. It’s just that it’s not fatal, and if you hadn’t dealt with other errors, it would have gone unnoticed again.

For myself, I always use tell application “System Events” when dealing with processes. I recommend this template to you too to avoid confusion with error handling.

Thanks KniazidisR!

I changed it to

also seems to cure the error on my site.

The hint lies in the name and description of the suite this stuff belongs too:

Thanks good to know!

Thanks everybody!