开发者

Get file name using drag-and-drop

开发者 https://www.devze.com 2022-12-17 17:05 出处:网络
Hi I have written applescript to get file name. on open of thisPDF set fName to thisPDF as string (* - - my code comes here.

Hi I have written applescript to get file name.

on open of thisPDF

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

end open

When i drop any file on my application's icon. This code help me to get the file name in fName variable but this gives me the path of that file like

"MacHD:Users:my Name:Desktop:file Name"

But what I want is only f开发者_如何学Goile Name.

How to do this?


Give this a try:

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

精彩评论

暂无评论...
验证码 换一张
取 消