Applescript 使用拖放获取文件名

Applescript 使用拖放获取文件名,applescript,Applescript,嗨,我已经写了applescript来获取文件名 关于打开此PDF set fName to thisPDF as string (* - - my code comes here. - - *) 断头 当我将任何文件放到应用程序图标上时。这段代码帮助我在fName变量中获取文件名,但这会给我该文件的路径,如 “MacHD:用户:我的姓名:桌面:文件名” 但我想要的只是文件名 如何做到这一点?尝试一下: set file_name to name of (info for alias "Mac

嗨,我已经写了applescript来获取文件名

关于打开此PDF

set fName to thisPDF as string
(*
-
-
my code comes here.
-
-
*)
断头

当我将任何文件放到应用程序图标上时。这段代码帮助我在fName变量中获取文件名,但这会给我该文件的路径,如

“MacHD:用户:我的姓名:桌面:文件名”

但我想要的只是文件名

如何做到这一点?

尝试一下:

set file_name to name of (info for alias "Macintosh HD:path:to:file.txt")

伟大的发现,我有很多问题,如何获得名称从拖放我可以得到如果从一个选定的文件夹。