How to combine 2 button commands into 1

I have 2 button

  1. Rename TO coverart.jpg
    What does this button do?
    It's Rename the selected files from anything to Coverart. Then Deselect the newly renamed file Coverart
  2. Copy DUPLICATE AS "folder{file|ext}"
    What does this button do?
    This button copies the selected file in the same folder and renames that into folder
    What is my goal?
    my goal is I want to combine these two commands into one button. I want to do all that action within 1 single Click.

Just put both lines in the same command, and order them so that both operations can succeed (i.e. do the rename last):

Copy DUPLICATE AS "folder{file|ext}"
Rename TO coverart.jpg

Since the second line assumes a .jpg file the {file|ext} seems like overkill, and you could simplify things a bit:

Copy DUPLICATE AS folder.jpg
Rename TO coverart.jpg

Unless you need it to convert other image formats to jpg first, but that wasn't asked for so I'm assuming it isn't needed.

Edit: Here's a slightly safer version that only acts on the first file (in case you select more than one), and requires a .jpg file to be selected:

@firstfileonly
@disablenosel:type=*.jpg
Copy DUPLICATE AS folder.jpg
Rename TO coverart.jpg

Thank you so much Leo

1 Like