up the folder hierarchy with applescript

any way to find the name of the containing folder through applescript and set it as a variable?

example:
there’s a “project” folder, inside of it is “images” folders. The “images” folder is opened on the desktop. I need applescript to be able to get the name of the containing folder “project” on what it sees “images”
finaly it has to be set as a variable

thank you

You can use this:

tell application "Finder" to ¬
	set x to name of parent of target of front window

thanks, worked