Simple "Open Folder"

Hi folks.

I have a path of a folder I need to open. “Users/rich/Projects/Project Receipts TBA”.

Because of the spaces, the scripts do not compile. I can’t figure out a way to get this done. Anybody have any suggestions?

I have:

tell application "Finder"
	set myW to make new Finder window with properties {target: Users/rich/Projects/Project Receipts TBA}
end tell

Cheers

Three points:

  1. Finder wants HFS paths, not POSIX.
  2. Finder’s dictionary says target should be a specifier, i.e. folder “HD:path:to:folder:”
  3. You cannot set properties of a window that does not (yet) exist.

So:

tell application "Finder"
	set myW to make new Finder window
	set target of myW to folder "HD:path:to:folder:"
end tell

Hi.

In addition to alastor933’s points, the Finder’s ‘make’ command has an unusual optional ‘to’ parameter, which can be used to set the target of a new Finder Window or alias file:

set targetPosix to "Users/rich/Projects/Project Receipts TBA"
set targetFolder to POSIX file targetPosix

tell application "Finder" to make new Finder window to targetFolder

Also, of course, you can simply tell the Finder to open the folder:

set targetPosix to "Users/rich/Projects/Project Receipts TBA"
set targetFolder to POSIX file targetPosix

tell application "Finder" to open targetFolder

Hi there.

1 & 2: My trials…even with spaces, HFS and POSIX were not working.

  1. I use this syntax for other new windows. Creation of a folder can take parameters, sent as properties.

Anyway, another post here fixed the issue. Cheers

Hi Nigel. Thanks for the reply.

The POSIX file targetPosix bit worked. Cheers