Opening folder

I’m puzzled why i can’t open a folder…

tell application “Finder”

set jobNum to display dialog "Job Number:" default answer "204094 Matis Deli" buttons {"Cancel", "OK"} default button 2
set userReply to text returned of jobNum
set workPath to "Art Department:  Work Files:"
open folder (workPath & userReply)

--open (first folder of disk "Art Department:  Work Files:" whose name begins with userReply)

end tell

the first open statement above opens the Matis Deli folder… if I use the second open statement and I have entered 204094 in the prompt window, I don’t get a folder… i get an error saying "finder got an error: Can’t get folder 1 of disk “Art Department: Work Files:” whose name starts with “204094”

can someone straighten me out?


Try doing this with your parentheses:

open (first folder of (disk "Art Department:  Work Files:") whose name begins with userReply)

If that does not work, try getting rid of the colons. I threw this together to test it out, and it worked:

set userReply to text returned of (display dialog "Enter the first few characters of a folder:" default answer "")
tell application "Finder"
	open (first folder of (disk "PilateII") whose name begins with userReply)
end tell

nuts… this still doesn’t work… does it matter that “Art Department” is a network drive?

if I say:

open folder “Art Department”

that opens the network folder… if I say

open folder “Art Department: Work Files”

that opens the work files folder on the network drive Art Department…

I just can’t seem to get the script to work when I am looking to open the folder that begins with a specific string.

any more suggestions?

That’s because " Work Files" isn’t a disk: it’s a folder. :slight_smile:

AHHHHH… ok that makes sense… here’s the statement that I now have working…

open (first folder in folder " Work Files" of disk “Art Department” whose name begins with userReply)