Finder windows in windows and not in tabs?

I have my general preferences set to “open things in Tabs”, because it’s extremely convenient 80% of the time, but when I script Finder to open a new window I’d like to have it open a damn new window and not a tab…

What would be the magic syntax for that ?

You just need to reverse the preference before and after Opening the window.

But there is a function that opens a “New Finder Window”.

You mean that there is no way to access that directly (except for UI scripting) ?

You can try:

tell application "Finder"
	make new Finder window
	set target of Finder window 1 to (path to documents folder)
end tell

Not. It doesn’t work (here?) I get tabs instead of windows.

Works here - latest Monterey version. I change the path the second time I run it, of course.

@suzume You seem to be confusing System Preferences with Finder Preferences.

Try this:

tell application "Finder"
	set tabStatus to folders open in new tabs of Finder preferences
	set folders open in new tabs of Finder preferences to false
	open (path to documents folder)
	set folders open in new tabs of Finder preferences to tabStatus
end tell

@emendelson Your Finder preferences must be set to open folders in window…

@ionah - But this is what I see in my Finder preferences:

Ok. Seems like Monterey does not behaves like Catalina…

Does my second script works for you?
I mean, is the syntax the same? No errors?

@ionah - yes, second script works also

Thank you. That works. I was not confusing System Preferences and Finder Preferences. I was just wondering why there was not a way to directly access the function “New Finder Window” in AS.