Gotcha, I didn't realize anyone was going to run the macro, but that's great - I re-cloned it and slimmed it down a bit, with all the required variables defined. I also tested extensively to make sure this replicates the issue and it does. Here is the new version:
Rename Project Copy.kmmacros (6.9 KB)
I also found a new clue in the logs that may indicate what's going on here. What follows is the Engine.log
block that results from running the attached macro. Look closely at the log entries that list the old file path that ends with Old Project Name.jpg
:
2021-11-22 16:58:20 Execute macro “Rename Project Copy” from trigger Editor
2021-11-22 16:58:27 Log: Old: /Users/todd/Old Project Name/Sessions/Old Project Name.jpg
2021-11-22 16:58:27 Log: New: /Users/todd/Old Project Name/Sessions/New Project Name.jpg
2021-11-22 16:58:27 Action 2661 failed: Move file /Users/todd/Old Project Name/Sessions/Old Project Name.jpg
failed with Error Domain=NSCocoaErrorDomain Code=4 "“Old Project Name.jpg
” couldn’t be moved to “Sessions” because either the former doesn’t exist, or the folder containing the latter doesn’t exist." UserInfo={NSSourceFilePathErrorKey=/Users/todd/Old Project Name/Sessions/Old Project Name.jpg
, NSUserStringVariant=(
Move
), NSDestinationFilePath=/Users/todd/Old Project Name/Sessions/New Project Name.jpg, NSFilePath=/Users/todd/Old Project Name/Sessions/Old Project Name.jpg
, NSUnderlyingError=0x60000221a970 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-11-22 16:58:27 Move file /Users/todd/Old Project Name/Sessions/Old Project Name.jpg
failed with Error Domain=NSCocoaErrorDomain Code=4 "“Old Project Name.jpg
” couldn’t be moved to “Sessions” because either the former doesn’t exist, or the folder containing the latter doesn’t exist." UserInfo={NSSourceFilePathErrorKey=/Users/todd/Old Project Name/Sessions/Old Project Name.jpg
, NSUserStringVariant=(
Move
), NSDestinationFilePath=/Users/todd/Old Project Name/Sessions/New Project Name.jpg, NSFilePath=/Users/todd/Old Project Name/Sessions/Old Project Name.jpg
, NSUnderlyingError=0x60000221a970 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} in macro “Rename Project Copy” (while executing Rename the session file).
You'll notice every instance in the log that prints the old filepath has an extra linebreak at the end, right after .jpg
. That shouldn't be there. It's most obvious if you look at the part of the log where it double-quotes the old filename. Between .jpg
and the closing quote, there is an extra linebreak.
That extra line break led me to believe that the action Rename everything in Sessions
is appending a linebreak to the end of the SelectedPath. So I did some additional experiments with the individual components of that path after they are parsed into new variables by the action Split up SelectedPath into its components
.
I did a number of experiments where I pieced together the components of the path, e.g.:
%Variable%SessionsDirPath%%Variable%SessionPathBaseName%.%Variable%SessionPathExtension%
But it appears that every one of the parsed components (including the extension) also contains an extra linebreak at its end. That's what appears to be happening as far as I can tell. But it also seems like that is the sort of bug that would affect an awful lot of macros out there, so I'm curious if I'm barking up the wrong tree.