Finder functions not working in AS in Animator

Why doesn’t this work? It’s a Run Applescript in an Animator Service, input is “Files or Folder” in Finder. Error is “Can’t get name of alias …”.

My scripts invoking Finder, called directly or as droplets (on open()), run fine. They fail only when called by a Service. There’s something about Services and Finder I’m not getting.


on run {input, parameters}
	tell application "Finder" to display dialog (name of input)
end run

Any thoughts would be greatly appreciated.

Thanks.

Model: Early '11 MacBook Pro
AppleScript: 2.10(194)
Browser: Safari 537.36
Operating System: macOS 10.13

The main issue is that input is a list

Look at the full error message : “Can’t get name of {alias … }”. The curly braces indicate the AppleScript list.

However if you change the line to

tell application "Finder" to display dialog (name of item 1 of input)

there is another error “Can’t make name of alias … into type string”

I think that display dialog which is part of Standard Additions and the Finder tell block interfere with each other.

Two solutions

tell application "Finder" to display dialog (name of item 1 of input) as text

or

tell application "Finder" to display dialog (get name of item 1 of input)