I realize this should be easy, but I’ve been banging my head on the desk trying to do it, and now it’s time to ask for help from the generous visitors to this forum.
My script will construct a POSIX path for a file that does not yet exist (because I’ll use a shell script later in the script in order to create the file). The full path might be something like this (and the filename will sometimes contain spaces):
“/users/roscoe/Desktop/My New File.txt”
(I’ll use quotation marks throughout to avoid escaping spaces, but there might be situations where I’ll need to use My\ New\ File.text with escapes.)
I want to put the filename and extension (not the full path) into a variable that I can display in a dialog box. In other words, I want to create a variable that looks like this:
set newname to “My New File.txt”
How can this be done?
Many thanks for any help.