Simple syntax query - filename variable.

I’m looking to create a droplet script to work with sending emails from an file that needs to be emailed - but got stuck a the first part of code. :frowning:


on open
	set filename to name of file
	display dialog filename
end open

returns:
Can’t get name of file

What is the correct syntax to assign a variable to a filename that is dropped on the AS app?

Thanks in Advance

Matt.


on open theDropped
	-- theDropped is a list
	set filename to name of (info for (item 1 of theDropped))
	display dialog filename
end open

Thanks Adam - that works great.

The references / examples that I’d found online all revolved around a list, I was trying to address just the single item. Using the “Item 1 of” is the part I was missing.

Thanks Again.

Matt.