0
votes

So, I had a pretty simple Automator task that I used from the 'Services' right-click pop-up menu in Finder that copied an image, renamed it, scaled it, then added a border around it. Worked fine for ages. The final step of it is to do the padding in an AppleScript, which starts with this incantation:

on run {input, parameters}
    set this_image to item 1 of input
...

And is meant to continue with this_image set to the file path from the previous step.

Since Big Sur, I get an error

The action “Run AppleScript” encountered an error: “Can’t get item 1 of {}.”

Which seems to indicate that input is now an empty list. So — perhaps the previous action (Rename Finder Items: Replace Text) does not pass a result — or something else.

Quick search via Google does not yield any clues, except some indication that breaking changes are part of the game and Apple doesn't really indicate what would break.

Any ideas? Every other step works fine — as I single-step, the file is manipulated as expected (duplicated, renamed, scaled, etc.). It's only when it gets to this line where I expect to have a filename in order to do the padding that there's an issue.

(Also, just in case someone wants to suggest using the 'Pad Images' automator action — the padding it performs isn't my kind of padding — it puts padding around the entire image. I just put padding at the top and bottom turning a 3x2 image into a square with the image proper sandwiched between white borders, top and bottom.)

1
You can see what the results of each step are, so why not just look? - matt
Yes, I have done so and in the step prior to the actual AppleScript that is expecting input there is no result, whereas previously there had been. The previous step is a filename manipulation, which had resulted ('returned') the new file name — now it doesn't. - bleeckerj
I can't reproduce that; for me, the filename manipulation does return a value which is passed on to the next step. - matt
Please do not cross post the same question on multiple Stack Exchange sites! You posted the same question on AskDifferent: apple.stackexchange.com/questions/414902/… - user3439894
I did cross-post. Not sure why this is a violation though. Perhaps you can explain? - bleeckerj

1 Answers

0
votes

The issue appears to be at one particular text replacement step, where I attempt to replace a string with a leading space with an empty string. For some reason, that fails — I am not sure why. But, when I change that particular step ('Rename Finder Items: Replace Text') to replace any string with a leading space with another character (say, an '_') it works fine. So I am deducing that replacing something with an empty string is the culprit, but I'm not 100% sure. But, now my Automator workflow works having adjusted that particular step.