Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Appleismylove

macrumors newbie
Original poster
Okay, so i'm working on an applescript that gets the file name of a user chosen file (actually i'm making an entire application around it), and i need help. 2 questions
1. I have gotten the file name and converted it to a POSIX path using this...

Code:
	set first_file to choose file without invisibles
	set thepath to first_file as text
	set theposix to POSIX path of thepath
😕
How do i get JUST the file name and extension. For example if i get this file /zzz/xxx/ccc/abc.txt
All i want is the file name (abc.txt) set to a variable like theextension

2. How do i set the rest of the file path to another variable (/zzz/xxx/ccc/) ? I have been having A TON of trouble with this, and all help is appreciated😀
 
Put
Code:
tell application "Finder" to set file_name to (name of first_file)
After the first-line and before the second.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.