tags:

views:

47

answers:

1

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 file Name.

How to do this?

+2  A: 

Give this a try:

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