Convert a list rom on open action to a single value

Hi I want to make an application but i have a little problem
I want detect the name of the folder wich contained my selected file but the problem is that don’t work with on open action
did someone can help me to fixe it ?
thanks

on open myfiles
	tell application "Finder" to set theFiles to the name of every file in item 1 of myfiles
--an other code is here that's why i call 2 times the Finder
tell application "Finder"
		repeat with aFile in theFiles
		set {name:Nm, name extension:Ex} to aFile
		set thePath1 to container of aFile
		set thePath to container of thePath1
		end repeat
		set Nom to name of container of aFile as string
		--display dialog Nom
		set saveHere to thePath & Nom & "_ref.mov"
	end tell

Hi,

the argument of the on open handler contains a list of alias specifiers.
You can process the list directly with a repeat loop


on open myfiles
	--an other code is here that's why i call 2 times the Finder
	repeat with aFile in myfiles
		tell application "Finder"
			set fileContainer to container of aFile
			set Nom to name of fileContainer
			set thePath to container of fileContainer as text
		end tell
		display dialog Nom
		set saveHere to thePath & Nom & "_ref.mov"
	end repeat
end open


I understand
thanks stefan for your light :wink: