Create a shortcut using MacOS Shortcuts to resize and delete original image

Hello Community!

I have a shortcut to convert and resize an image that I have airdroped to my MacbookAir. So far so good. See this:



As I use quick action as follows. Right click on the *.HEIC image in a folder and choosing the Convert and resize options like so:


What I miss is an option to delete initial image (deleting the original HEIC image), after it was converted to jpg and saved to the folder.

Whatever I choose, it seems not an option to move to bin or delete the original HEIC-file.


Any ideas or inputs how to delete the original file and add this step to the shortcut?

I use this shortcut multiple times per week and it is really convenient to have this option but it does not seem to offer the exact solution to me.


Thanks in advance!

MacBook Air 13″, macOS 12.6

Posted on Apr 3, 2023 4:53 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 6, 2023 1:00 AM

I found it, at last! Goddamit, that took a while!!! OK, now I know how it works!


You have to right-click to the right of the "Delete" function and in this context menu you can then choose e.g. the variable or directly the "Shortcut Input" as shown below. This will in turn separate this step from the rest of the script (no connection to previous steps) and allows to delete the original file.

Hint: The variable is not needed as you can directly choose the input file.



Thanks! This case is solved!


Similar questions

12 replies
Question marked as Top-ranking reply

Apr 6, 2023 1:00 AM in response to UweTheSailor

I found it, at last! Goddamit, that took a while!!! OK, now I know how it works!


You have to right-click to the right of the "Delete" function and in this context menu you can then choose e.g. the variable or directly the "Shortcut Input" as shown below. This will in turn separate this step from the rest of the script (no connection to previous steps) and allows to delete the original file.

Hint: The variable is not needed as you can directly choose the input file.



Thanks! This case is solved!


Apr 4, 2023 11:43 PM in response to Tony T1

Thanks for your help!

I like your thinking!

I did exactly as you suggested. Spoiler alert, it did NOT work. See the screenshot:


I think the problem is the consecutive order that is indicated with the lines (see red circles). No matter what I call the variable, it will always delete the previous item which happens to be the file that was just created. It does not go back to the original file (the shortcut input) but rather looks back to the last step (in this case the Convert function).


It seems for simple things shortcuts is ok, but for more complex things it does not work. If there would be an option to fork the "program" and one part converts and the other waits a period of time and then deletes the file that might work. But I cannot find any solution how to fork the "script" in two separate parts.


I might need to look into writing an apple script that will do this job...

Thanks much!

Apr 3, 2023 11:59 PM in response to Camelot

Thank you so much for your help! Highly appreciated!!!


I did exactly what you suggested. Have you tried this on your own? My workflow is to AirDrop a photo taken on my iPhone (HEIC-file, raw-photo) and on the received file in my MacBookAir (Monterey) I right click and execute the Shortcut (as indicated above).


If I do that, with exactly your suggestion, the new file (the actual file I want to use) will be deleted. Not the original HEIC-file but the newly created JPG-file that was just created will be thrown away again... Not very helpful. I use applescript and know a bit about programming, but shortcuts seem to operate differently than other programming methods. It seems the variable Shortcut Input does not exist or is assigned to the new file?


That is why it is so complicated to delete the original file and keep the actual created file. Somehow I run in circles...


See my shortcut screenshot here:

Thank you!

Apr 5, 2023 6:16 AM in response to UweTheSailor

I love this. I think the next logical step is to create a folder with actions that you can put on the dock -AppleScript taught me that. I think shortcuts has tons of limitations because it doesn’t just have free rein on the system. So also make sure the app has the security and privacy settings configured correctly. Full disk access to start..


I’m thankful there are so many of people that just want to help. I dig that.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Create a shortcut using MacOS Shortcuts to resize and delete original image

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.