Your first action
Add a "Count Lines" command to the right-click menu, then give it an icon, a submenu and a shortcut.
This walkthrough adds an action that counts the lines in the selected text files. It uses wc, which is part of macOS, so there is nothing to install.
Open the config file
In MacScout, click Actions (⚡) in the toolbar and choose Edit Actions…. The config file opens in your editor. You can also get there from Settings → Actions → Edit config.jsonc.
Add the action
Find the "actions" list at the end of the file and add this object to it:
"actions": [
{
"title": "Count Lines",
"command": "wc -l {files}",
"extensions": ["txt", "md", "swift", "js", "ts", "json"],
"output": "show"
}
]Save
MacScout notices the change right away. There is nothing to restart.
Try it
Select one or more text files, right-click, and choose Count Lines. A window opens with the output of wc.
What each line does
titleis the name in the menu.commandruns in your shell.{files}is replaced with the selected files, each wrapped in quotes, so names with spaces work. Because the command uses{files}, it runs once for the whole selection.extensionslimits the action to files with these extensions. When you filter by extension, folders are left out automatically."output": "show"opens a window with whatever the command printed. Without it, MacScout runs the command, reloads the folder and shows a short "done" message.
Make it yours
Three optional fields make an action feel at home:
{
"title": "Count Lines",
"icon": "number",
"menu": "Text",
"command": "wc -l {files}",
"extensions": ["txt", "md", "swift", "js", "ts", "json"],
"output": "show",
"shortcut": "ctrl+cmd+l"
}iconis the name of an SF Symbol. Apple's free SF Symbols app lists them all.menuputs the action into a submenu. Actions with the samemenushare one submenu.shortcutruns the action from the keyboard whenever it applies to the selection. See Keyboard shortcuts for the format and for combinations to avoid.
If it doesn't work
The action isn't in the menu. Check that your selection matches the filters: here, every selected item has to be a file with one of the listed extensions. Then open Settings → Actions. If the config file has an error, it is shown at the top. MacScout keeps using the last version that worked until you fix it.
The command fails. MacScout shows the error the command printed. Run the same command in Terminal to see what's going on.
"command not found". Commands run in a login shell, which reads ~/.zprofile but not ~/.zshrc. Tools that are set up in ~/.zshrc, like nvm, aren't found. See Placeholders and environment for ways around it.