I am trying to get the name of file using AppleScript with the following code:
tell application "Finder"
set filename to name of "/Users/mainuser/Desktop/Test/shot.png" // should return shot.png
display dialog filename
end tell
I am getting an error saying:
error "Can’t get name of \"/Users/mainuser/Desktop/Test/shot.png\"." number -1728 from name of "/Users/mainuser/Desktop/Test/shot.png"
What I am doing wrong?