New Finder Window Script

I have a script that will create a new Finder winow of a specific size. It works as a script, but if I try to save it as an applet it doesn’t work. And, it doesn’t matter if I make it background only or not, neither works. Any help appreciated.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Finder"
	activate
	make new Finder window
end tell

tell application "System Events"
	tell process "Finder"
		set the frontWindow to window 1
		set size of the frontWindow to {1008, 568} -- Adjust width and height here
		set position of the frontWindow to {0, 0} -- Position at the left edge of the screen
	end tell
end tell

Why use System Events here? Just put the commands inside the Finder tell block.

The ‘process’ stuff is for the process suite in System Events, which generally means that there isn’t a normal applescript interface (eg clicks, menus, etc…).

The functionality that is required here is provided naturally by the Finder.

Try this:

tell application "Finder"
	activate
	set fw to make new Finder window
	
	set bounds of the fw to {0, 23, 1008, 591} -- Adjust width and height here	
end tell

NB The top position that a window can have on a display with a menu bar is 23. I added 23 to the bottom position as well, in order to maintain the window size.

Thank you, that works perfectly, both as a script and as an applet.

1 Like