Open a folder based on user input

Hello everybody!

I need the user to input a number in a dialog

then I want the finder to open a folder whose name contains the number in a specific location

What I tried so far doesn’t work, my syntax is probably wrong, I need a little help please!

set CodeUnique to (display dialog "Quelle est le code unique de votre livre" default answer "")
set CodeUniqueString to text returned of CodeUnique

--
tell application "Finder"
	set MyFolder to folder whose name contains CodeUniqueString of folder "zARCHIVE" of disk "bouquin_plus"
	open MyFolder
end tell

Hi,

try this


set {text returned:CodeUniqueString} to (display dialog "Quelle est le code unique de votre livre" default answer "")

--
tell application "Finder"
	try
		set MyFolder to 1st folder of folder "bouquin_plus:zARCHIVE" whose name contains CodeUniqueString
		open MyFolder
	on error
		-- error handling
	end try
end tell

Thank you it’s working :slight_smile:

Can you tell what was wrong in what a did. Was it the part before my tell block or the way I was asking to find the folder?

the syntax must be

folder of [reference] whose [filter]

you did

folder whose [filter] of [reference]

Thanks a lot again :slight_smile: