I have an Automator workflow that is saved as an application. It runs at the end of an AppleScript with a Tell - Activate command.
The Automator action exports an image from Photos, renames and resizes the image, then moves it to the desired folder. This is necessary because Automator always and only exports to a new folder in the User’s Pictures folder.
Everything works fine if I use the Move Finder Items and designate the desired folder within that action through the dropdown.
What I would like to do is be able to move the image to a folder where the pathname varies with the current year. That is, the application works fine now. In 2025 I’ll have to edit the action to point to another Images folder within a 2025 folder. I would like to “automate” the path selection.
I thought I’d try a Shell Script Variable and set the path like this,
current_year=$(date +‘%Y’)
path=“/Users/daverogers/Documents/Tinderbox Files/Nice Marmot Exports/Archives/${current_year}/Images”
echo $path
(I’m not sure if this is correct, I’m using ChatGPT here. It’s 2024, it’s what all the cool kids are doing.)
The first problem is that it seems you’re supposed to be able to place a shell script within a shell script variable. When I open the shell script variable, I get this:
There is no way to enter a shell script into that field.
I don’t know if Automator is broken or what (I’m on Sonoma 14.3.1).
Failing this, would it be better to run some other script within a “Run Shell Script” action, or perhaps a “Run AppleScript” command, to actually move the file to the relevant folder based on the current year?
I’m uncertain if Automator would execute the script on the image file within the workflow automatically. I could experiment, but I’ve been futzing with this for a while now and I’m getting a little impatient.
As it is, everything works fine, but if I could just make it pick the current year folder automatically, I think it would be much more satisfactory.
Here’s what the current workflow looks like, though the “working” version has the name Image for the Move Finder Items action.
Appreciate any insight or advice.
Thanks.