Get file name using drag-and-drop
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")
精彩评论