Just had to move from a macOS 10.12 machine to a macOS 11, the script I have been using to process PDF files is now broken. The script creates two PDF files, and adds a _LR or _HR to the end of the filename then files them to a server.
Problem is that when the script is told the name now has _LR at the end, it doesn’t seem to recognise this and tries to move the original filename. Which doesn’t exist. Has how AppleScript references the filename changed?
It’s just this part of the script where aPDFNoPrint is the original name and filename is the new name.
tell application "Finder" to set name of aPDFNoPrint to filename[/AppleScript]
Here is the result, you see the name it tries to move hasn't changed.
set name of alias "MacSSD:Users:admin:Documents:PDF:DistillerResources:lowHolding:DCG369~3962_100_009692_00_80x1400.pdf" to "DCG369~3962_100_009692_00_80x1400_LR.pdf"
do shell script "/bin/mv -f
The change is not directly due to the change of OS version, but rather the subsequent change from HFS+ disk formatting to AFPS. AppleScript aliases use the old alias manager, and this does not support AFPS disks.
You will have to update the paths yourself.
I just cloned to a HFS+ formatted drive and I get the same problem.
Issue I have is this script auto processes hundreds of InDesign files a day, I can’t really manually update the path. Does this mean this type of script will no longer run on macOS?
When you rename a file, its Posix path also changes. Therefore, in the move command, you must specify the Posix path with new name instead o old name. Also setting name of name in the Finder doesn’t make sense. Set name of file instead
That is what this part of the script has been doing for many years, its just going to 10.14 and above has broken this part. Is there any new way of achieving the same function?
First, I don’t see your script yet, other than a sloppy sketch. It is not clear, for example, what is it aPDFNoPrint? It’s an AppleScript alias, Finder file reference, or a string like “Hello, here I am!”
Fair enough, I was just trying not to paste the entire script as it might not be relevant to the process that no longer works. Seems others are having the same issue after going to Mojave/APFS, I just thought there might be a known alternative method. Thanks all the same.
It’s not about posting the entire script. As you point out, your ‘mv’ command is trying to move a file that doesn’t exist.
So how are you getting the incorrect file reference into that line? The code you’ve posted doesn’t reveal that. It only reveals the file you wish to move.
By the way, both ends of the tags should be lower case for the formatting to work.