No internet connection
  1. Home
  2. Macro and Script Help

Finder rename multiple items

By Omar Gonzalez @Omar_Gonzalez7
    2023-03-06 20:22:03.152Z

    Title

    Finder rename multiple items

    What do you expect to happen when you run the script/macro?

    When highlighting multiple items in Finder, right clicking them and selecting Rename... so that I can rename them all

    Are you seeing an error?

    06.03.2023 12:20:14.98 [Backend]: #Key: command+r (15) -> Finder Rename [clex9g7io0004ye10t6t8pvjg] >> Command: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]

    06.03.2023 12:20:15.03 [Backend]: Mouse current pos is: (1183.2227783203125, 812.2381591796875)
    Clicking with mouse here: (1183.2227783203125, 812.2381591796875)

    06.03.2023 12:20:15.04 [Backend]: Moving mouse back to: (1183.2227783203125, 812.2381591796875)

    06.03.2023 12:20:15.04 [Backend]: Position is now: (1183.2227783203125, 812.2381591796875)

    06.03.2023 12:20:15.09 [Backend]: Command accepted for app: com.apple.finder

    06.03.2023 12:20:15.26 [Backend]: Logging error in action (01) ClickPopupMenuAction: Could not find menu item with name: Rename...

    06.03.2023 12:20:15.26 [Backend]: !! Command Error: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]:
    Could not find menu item with name: Rename... (Finder Rename: Line 9)

    << Command: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]

    What happens when you run this script?

    A right click is performed and the popup menu comes up, but then nothing.

    How were you running this script?

    I used a keyboard shortcut within the target app

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "When highlighting multiple items in Finder, right clicking them and selecting Rename... so that I can rename them all",
        "inputIsError": true,
        "inputError": "06.03.2023 12:20:14.98  [Backend]: #Key: command+r  (15) -> Finder Rename [clex9g7io0004ye10t6t8pvjg]\n>> Command: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]\n\n06.03.2023 12:20:15.03  [Backend]: Mouse current pos is: (1183.2227783203125, 812.2381591796875)\nClicking with mouse here: (1183.2227783203125, 812.2381591796875)\n\n06.03.2023 12:20:15.04  [Backend]: Moving mouse back to: (1183.2227783203125, 812.2381591796875)\n\n06.03.2023 12:20:15.04  [Backend]: Position is now: (1183.2227783203125, 812.2381591796875)\n\n06.03.2023 12:20:15.09  [Backend]: Command accepted for app: com.apple.finder\n\n06.03.2023 12:20:15.26  [Backend]: Logging error in action (01) ClickPopupMenuAction: Could not find menu item with name: Rename...\n\n06.03.2023 12:20:15.26  [Backend]: !! Command Error: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]:\nCould not find menu item with name: Rename... (Finder Rename: Line 9)\n\n<< Command: Finder Rename [user:ckz8y90wh0000o310s4q3479y:clex9fxhh0003ye10y7whkwb1]",
        "inputWhatHappens": "A right click is performed and the popup menu comes up, but then nothing.",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 3,
        "inputTitle": "Finder rename multiple items"
    }

    Source

    
    const position = sf.mouse.getPosition().position;
    
    const popupMenu = sf.menu.openPopupMenuFromPosition({
        position: position,
        isRightClick: true,
    }).popupMenu;
    
    popupMenu.menuClickPopupMenu({
        menuPath: ["Rename..."],
    });
    
    
    

    Links

    User UID: aMkTBTHB3he77TafFWFI244Jm9j1

    Feedback Key: sffeedback:aMkTBTHB3he77TafFWFI244Jm9j1:-NPs_dbGgrSDxRre9inU

    Feedback ZIP

    Solved in post #2, click to view
    • 2 replies
    1. @Omar_Gonzalez7, much easier to do it through the menu item than the right-click menu, like so:

      sf.ui.finder.menuClick({ menuPath: ['File', 'Rename'], looseMatch: true });
      

      *looseMatch takes care of matching the menu item regardless of it being "Rename" or "Rename...", so now you can use the same trigger to rename either a single file or multiple files.

      Reply2 LikesSolution
      1. OOmar Gonzalez @Omar_Gonzalez7
          2023-03-06 22:45:06.802Z

          Thank you!