Problem getting Parent Folder in Droplet

Having a problem trying to figure out why I can get the parent folder of container when I use it in an on run ,but can’t get the parent folder of container when i use it in an on Open. It gives me an error with the on Open Droplet.
This is my code:


 on run
	-- Get the path of the parent folder of folder selected
	set Orig_path to choose folder with prompt "Select Folder!" --folder of path wanted
	
	tell application "Finder"
		set Parent_Folder to container of (Orig_path) as text
		display dialog Parent_Folder
	end tell
end run

on open this_item
	set Orig_path to this_item as text
	--display dialog Orig_path as string
	
	set Parent_Folder to (container of (Orig_path)) as text
	display dialog Parent_Folder as string
end open

Hi,

actually the parameter of the on open handler is


on open these_items

which is always a list of items.
And you forgot to ask the Finder for the container


on open these_items
	set Orig_path to item 1 of these_items
	--display dialog Orig_path as string
	
	tell application "Finder" to set Parent_Folder to (container of Orig_path) as text
	display dialog Parent_Folder
end open

Alternatively you can also use System Events, it has a path property for the HFS path


.
tell application "System Events" to set Parent_Folder to (path of container of Orig_path)
.

Stefan

Thanks, that is what it needed.