Nilesoft Shell GitHub

Menu Builder


The Menu Builder adds your own items and submenus to the right-click menu without writing any code. You fill in a form: the title, an icon, the program to run and where the item shows. The app writes the configuration for you and checks it before saving.

Everything you build here goes into its own file, so the rest of your configuration is never touched. When you open the page again, the app reads that file back into the tree.

The Menu Builder page: the tree on the left, the form on the right, the preview below
Menu Builder: your menus and items on the left, the selected one's properties on the right, and a preview of the menu below.
The page at a glance
  • The tree (left) lists your entries in menu order. Above it, Item, Menu and Separator add entries, and a row of small buttons moves, indents, duplicates or deletes the selected one. Hover a button to see its name.
  • The form (right) edits the selected entry. It has four parts: the title and icon, Where it shows, What it runs (items only) and Look.
  • Preview (bottom) draws the menu roughly as Shell will show it, with the selected submenu open. Generated .nss shows the exact text that Save will write.
  • Save and Discard are at the top right. Nothing reaches your menu until you save.
Add an item

This example adds Open in Notepad to the menu of every file.

  1. Click Item. A new entry called New item appears in the tree and is selected.
  2. In Title, type Open in Notepad. To give the item an access key (the underlined letter you can press while the menu is open), put & before that letter, as in Open in &Notepad.
  3. In Command, type notepad.exe. This is the program the item starts: a program name such as notepad.exe or code, or the full path of a program or file.
  4. In Arguments, type "@sel.path". Shell replaces @sel.path with the path of the file you right-clicked. Keep the double quotes, so paths with spaces still work.
  5. Click Save, then right-click a file to see the new item.

An item shows when one item is selected. To show it when several files are selected, set Selection to Any selection. The other choices are Several of one type, Several with one extension and Nothing selected; see mode for what each one means.

Add a submenu

A menu is an entry that opens a submenu. Whatever is inside it shows when you point at it. Where a new entry goes depends on what is selected:

  • nothing selected: at the end of the tree;
  • a menu selected: inside that menu, at the end;
  • an item or separator selected: right after it, at the same level.

To build a Dev tools submenu with two items and a line between them:

  1. Select the last top-level entry (or nothing, if the tree is empty) and click Menu. Name it Dev tools.
  2. With Dev tools selected, click Item. The item goes inside the menu; the tree shows it indented. Name it Task Manager and set Command to taskmgr.exe.
  3. With Task Manager selected, click Separator. A line is added right after it, still inside the menu. A separator has no settings.
  4. With the separator selected, click Item again. Name it Flush DNS, set Command to cmd.exe and Arguments to /c ipconfig /flushdns.
  5. Click Save.

Instead of adding a separator as its own entry, you can also set Separator in the Look part of the form to Before, After or Before and after. That draws a line next to that one entry.

Choose an icon
  1. Select the entry and click Choose… next to Icon.
  2. The picker shows the glyphs of Shell's own icon font. Point at one to see its code at the bottom (for example image=), and click it to use it.
  3. To remove the icon, click No icon. Esc or a click outside the picker closes it without a change.

You can also type into the Icon box: one of Shell's named icons such as icon.task_manager, a colour, or the path of an icon or program file. The small square next to the box shows the glyph when it is one from the font, and … for anything else. See image for every form the value can take.

Choose where it shows

Shows on, under Where it shows, decides which right-clicks show the entry. On a menu, it applies to the whole submenu.

EverywhereFiles, folders, backgrounds, the desktop and drives: every menu except the taskbar's. This is the default.
FilesAny file.
FoldersA folder you right-click.
Folder backgroundAn empty spot inside an open folder.
DesktopAn empty spot on the desktop.
DrivesA drive, such as C:.
Files with extensionsOnly files of the types you list in Extensions, separated by spaces, like .txt .md .log. A missing dot is added for you, and the list is saved in lower case.
CustomThree boxes for the raw values: Type (for example file|dir), Find (name or extension patterns, like *setup*) and Where (a condition, like sel.count > 1). See type, find and where.

For example, to show Open in Notepad only on text files, set Shows on to Files with extensions. The Extensions box starts with .txt; add more types if you like.

Run as administrator, and the window
  • Tick Run as administrator for a command that needs it, such as Flush DNS above. Windows asks for permission each time you click the item.
  • Window sets how the program's window opens: Normal, Hidden, Minimized or Maximized. Hidden suits a command such as cmd.exe /c … that would otherwise flash a console window.
  • Shortcut text is shown at the right of the item, like Ctrl+E. It is only a label: it doesn't make the keys work.
  • Tooltip is the text that appears when you rest the mouse on the entry.
Reorder and indent

Select an entry, then use the buttons above the tree:

Move up, Move downSwap it with the entry above or below, within the same menu.
IndentMove it into the menu right above it, as that menu's last entry. Only possible when the entry above is a menu.
OutdentMove it out of its menu, to just after that menu.
DuplicateAdd a copy right after it. A copied menu keeps its contents.
DeleteRemove it. Deleting a menu removes everything inside it.

A button that can't be used for the selected entry is greyed out.

Save, discard and undo
  • Save checks your menus with Shell and writes them. If Shell would reject them, nothing is written and a message says what is wrong and on which line.
  • Discard throws away every change since the last save.
  • To undo a change you already saved, open Backups. Each save takes a snapshot first, named for example Menu Builder: 1 menu, 3 items. Select the snapshot from before your change and click Restore….
  • To remove all your menus at once, turn off Your menus on the Context Menus page. The file is kept, so you can turn it back on.
Example: from the form to the menu

Here are both tasks above together, with two extra settings: Open in Notepad only on .txt files, and Dev tools only on the desktop, with an icon.

  1. Click Item. Title Open in Notepad; Shows on Files with extensions, Extensions .txt; Command notepad.exe; Arguments "@sel.path".
  2. With Open in Notepad selected, click Menu. Title Dev tools; Choose… an icon; Shows on Desktop.
  3. With Dev tools selected, click Item. Title Task Manager; Command taskmgr.exe.
  4. With Task Manager selected, click Separator.
  5. With the separator selected, click Item. Title Flush DNS; Command cmd.exe; Arguments /c ipconfig /flushdns; Window Hidden; tick Run as administrator.
  6. Click Save.

The tree now reads Open in Notepad, then Dev tools with Task Manager, a separator and Flush DNS indented under it. Generated .nss shows what is written (the icon code is the one you picked):

// generated by Nilesoft Shell Pro, do not edit by hand
// Edit these menus on the Menu Builder page of Nilesoft Shell Pro.

item(title="Open in Notepad" type='file' find='.txt' cmd='notepad.exe' args='"@sel.path"')

menu(title="Dev tools" image= type='desktop')
{
	item(title="Task Manager" cmd='taskmgr.exe')
	separator
	item(title="Flush DNS" cmd='cmd.exe' args='/c ipconfig /flushdns' admin window=hidden)
}

In the menu:

  • Right-click a .txt file: the menu has Open in Notepad, which opens that file in Notepad. Right-click any other file, or select two text files: the item isn't there.
  • Right-click an empty spot on the desktop: the menu has Dev tools with its icon and an arrow. Point at it to open the submenu: Task Manager, a line, then Flush DNS. Flush DNS asks for administrator permission, then runs with its window hidden.
  • Right-click a file or folder: Dev tools isn't there, because it shows only on the desktop.
What it writes

For the curious: each entry becomes one line of Shell's menu language, in tree order.

  • An item becomes item(...), a menu becomes menu(...) followed by its entries in { }, and a separator becomes separator.
  • The form fields map to properties: Title to title, Icon to image, Shows on to type, find and where, Selection to mode, Command to cmd, Arguments to args, Run as administrator to admin, and Window, Shortcut text, Tooltip and Separator to window, keys, tip and sep. Empty fields are left out.
  • If the file has properties the form doesn't edit (because someone wrote them by hand), the entry shows them under Kept as written, and they are saved unchanged. Lines that aren't menus, items or separators can't be kept: a banner warns that they will be dropped on the next save.
Where your changes are saved
  • Your menus are written to imports\settings-app-menus.nss in your configuration folder (%APPDATA%\Nilesoft\Shell). The file is generated: edit it on this page, not by hand.
  • The first save adds import 'imports/settings-app-menus.nss' at the end of shell.nss, so it loads after the bundled menus. If that line is already there, even turned off, it is left alone.
  • Before writing, the new configuration is checked with shell -config:check. A configuration Shell would reject is not written.
  • Each save first takes a snapshot in Backups.
  • Shell reloads the configuration by itself when the file changes; there is no restart step.
  • If Explorer uses the shared configuration in the program folder, the page is read-only and offers Create personal config. Program Files is never written to.
Troubleshooting
The new item doesn't show at allClose the menu and right-click again. If it still isn't there, use Restart Explorer on the Home page. If the page shows Your menus are turned off, click Open Context Menus and turn Your menus back on.
It shows in some places but not where I expectCheck Shows on: an item set to Files isn't on folders, and Desktop is only the empty desktop. Check Selection too: with the default, the item hides when several items are selected. A submenu's Shows on also limits every entry inside it.
Clicking the item does nothingThe command can't be found or doesn't accept the arguments. Use the full path of the program, and put "@sel.path" in quotes.
Not saved: Shell would reject these menusUsually a value typed in a Custom box, such as an unfinished Where condition. The message names the line; fix it in the form and save again.
Part of the file can't be shown hereThe file has lines the page doesn't understand, probably from an edit by hand. They will be dropped when you save. Copy them elsewhere first if you need them.