More Scripting Help

: I’m working on the script below
: tell application
: “Finder”
: activate
: select disk “Preflight”
: open selection
: select folder “Inprogress” of disk
: “Preflight”
: open selection
: select folder “Working” of folder
: “Inprogress” of disk Preflight
: open selection
: Now here’s where I get lost, I want to open the folder
: thats’s inside the folder “working”. That
: folders name will
: change every time. Once that folder is open, I want to
: locate the file that contains “.pdf” and
: move it to another
: folder of the disk “Preflight” Can anyone help?
As Guy says, you don’t need to open every folder in the hierarchy, or any of them in fact. Also, a path reference (folder “Preflight:Inprogress:Working:”) is generally faster than a Finder reference (folder “Working” of folder “Inprogress” of disk “Preflight”). You don’t say if the folder inside “Working” will be the only one there or whether it’s just that you’ll choose a different one each time. Assuming the former case, you could do something like this:

tell application "Finder" -- Get a list of the folders inside "Working"
	get every folder of folder "Preflight:Inprogress:Working:" -- If there's at least one, get the first of these
	-- and move all its pdf files to your other folder
	if the result is not {} then
		set theFolder to item 1 of the result
		move (every file of theFolder whose name ends with ".pdf") ¬
			to folder "Preflight:Another Folder:"
	end if
end tell