This should be easy.
Our company has filenames that use this format: yyyymmdd.brand.customername.pics
Objective: for each FILE, create a new FOLDER with the same name, without the file extension.
Example of automation objective:
Source File: 20210301.ABC.Jones.pics (file)
Target Result: 20210301.ABC.Jones (folder)
I've been trying unsuccessfully to obtain the name of the source file that excludes the path.
My automation is a folder action (here are the pertinent steps)
- When file dropped into a specific folder, set variable TPEPathname = the filename (with path)
- Get the value of variable TPEPathname from Step 1, pass the value into the next step.
- Obtain a reference to the file using Get Selected Finder Items, pass the reference to the Finder object into the next step
- Run AppleScript to obtain the name of the Finder object filename EXCLUDING THE PATH (see attached photo for the AppleScript)
Step 3 is successful. Step 4 returns nothing. (ignore fileNamex)
I also tried to change the sequence by passing in the TPEPathname directly into the AppleScript, instead of passing in the Finder object. Same result - Step 3 is successful, Step 4 returns nothing.
Questions: Am I referencing the Step 3 Finder object correctly as an INPUT or PARAMETER within the AppleScript? The value of "Input" seems to be null. I don't see documentation on how to pass in or reference AppleScript parameters.
Will the function "fileName" in the AppleScript actually obtain and parse the filename without the path, or will the additional periods in the filename cause a problem? Acceptable result will be either: yyyymmdd.brand.customername OR yyyymmdd.brand.customername.pics
input
is a list of alias specifiers. At least you need a loop for process each file separately. Apart from that an alias does not respond tofileName
. And you are going to displayfileName
rather thanfileNamex
. So there are 3 syntax errors. – vadianGet Finder Items
passes always a list of alias specifiers to the next action (or an empty list). You can get the file name from an alias only with theFinder
orSystem Events
. Already the first linedisplay dialog input
is a syntax error. The direct parameter must betext
. – vadian