When an action appears
The rules MacScout uses to decide whether a custom action belongs in the menu.
Each time you open a menu or press a shortcut, MacScout checks every custom action against the current selection. An action appears only if all of these hold:
- It is enabled.
"enabled": falsehides it. - Something is selected, or it allows an empty selection. With nothing selected, only actions with
"background": trueappear, and only when a folder is open. The other rules don't apply in that case. - The selection has the right size. At least
minSelectionitems and at mostmaxSelectionitems, where set. - Every selected item matches. One item that doesn't match hides the action for the whole selection.
Matching an item
A folder matches if folders is true. When you don't set folders, it is true for actions without extensions or types, and false for actions with them. A filter for image files shouldn't show up for folders, and doesn't.
A file matches if files isn't false, and:
- its extension is in
extensions, if you setextensions. Write extensions without the dot."PNG"and"png"both matchphoto.png. - its type is one of the
types, or a more specific type of one, if you settypes.
extensions and types can be combined. A file then has to pass both.
Types
types takes Uniform Type Identifiers. A file matches a type when its own type is that type or conforms to it, so "public.image" covers JPEG, PNG, HEIC and every other image format. Some useful ones:
| Identifier | Covers |
|---|---|
public.image | All images |
public.movie | All video files |
public.audio | All audio files |
com.adobe.pdf | PDF documents |
public.text | All text, including source code and JSON |
public.plain-text | Plain text files |
public.source-code | Source code files |
public.json | JSON files |
public.archive | Archives such as ZIP |
To see a file's type and everything it conforms to, run:
mdls -name kMDItemContentType -name kMDItemContentTypeTree "file.heic"Examples
Images only:
{ "title": "Optimize", "command": "…", "types": ["public.image"] }Exactly two files, no folders:
{ "title": "Compare", "command": "diff -u {files}", "output": "show", "minSelection": 2, "maxSelection": 2, "folders": false }Folders only:
{ "title": "Folder Size", "command": "du -sh {files}", "files": false, "folders": true, "output": "show" }Only on empty space in a folder. background adds the action for an empty selection, and "maxSelection": 0 removes it for any selection:
{ "title": "New README", "command": "…", "background": true, "maxSelection": 0 }Any selection, and empty space too:
{ "title": "Back Up", "command": "~/bin/backup {files}", "background": true }The Home view
Home shows your drives and recent files rather than a folder, so there is no open folder there. Actions with "background": true don't appear on its empty space. When you right-click a recent file, {folder} is the folder that contains it. From the Actions menu or a shortcut, {folder} is empty.