Selecting folder within folders

I need to select a specific folder and am having trouble with it…

tell application "Finder"
	open folder "G1:Art Department 2:Work Files2"
end tell

opens the folder, so I know I have that folder name correct.

now what I want to do is select a folder within that folder who’s name begins with <<job_num>>

so I tried…

set MyJobFolder to name of folder of "G1:Art Department 2:Work Files2" whose name begins with "262269"

that returns:

error “Can’t get folder of "G1:Art Department 2:Work Files2".” number -1728 from «class cfol» of “G1:Art Department 2:Work Files2”

how do I need to write that line of code?

thanks
david

Hi,

you’re very close :wink:


tell application "Finder"
	set MyJobFolder to name of 1st folder of folder "G1:Art Department 2:Work Files2:" whose name begins with "262269"
end tell

grrrrrrr…

given:


	tell application "Finder"
		set MyJobFolder to (name of 1st folder of folder "G1:Art Department 2:Work Files2:" whose name begins with JobNum) as string
	end tell

	set myDestFile to JobNum & "proof.indd" as string
	save document 1 to myDestFile in MyJobFolder


I get the error:
error “Can’t get myDestFile of "262257 IMA Council".” number -1728 from myDestFile of “262257 IMA Council”

I want to save this file as a file named <>proof.indd in the folder MyJobFolder

What did I miss?
david

You need the full path to the folder, not just the name

Try this


tell application "Finder"
	set MyJobFolder to (1st folder of folder "G1:Art Department 2:Work Files2:" whose name begins with JobNum) as text
end tell

set myDestFile to MyJobFolder & JobNum & "proof.indd"
tell application "Adobe InDesign CS6"
	save document 1 in myDestFile
end tell


Cool… I think I have it.

in that last snippet it should be save TO, instead of save IN

david