Skip to content

The file action menu

A script can also start from a person’s own click. Scripts set up this way appear in the file browser’s context menu. A person selects one or more files, opens the menu and picks the script. Foldr calls these user mashlets, and the Settings tab for them is Users & groups.

Use this for jobs a person decides on case by case: “send this to accounts”, “stamp as approved”, “pack these into a zip”.

  1. Open Settings > MaSH > Users & groups.
  2. Choose Add new. A panel opens with four tabs.
  3. On Script, give it a Name, pick the Script, and optionally set an Icon. The name is what people see in the menu.
  4. On Permissions, choose who may use it. The permission is called Use Mashlet. Add people or groups.
  5. On Files, set Minimum and Maximum (0 means unlimited) and File types. The menu entry shows only when the selection fits.
  6. On Input, add the questions the script asks when it runs, each with a Name, a Type and a Default.
  7. Choose Save. If the script has config parameters, a Configuration section appears so you can fill them in for this entry.

In the web app, a person who has access sees MaSH it in the context menu. When only one script fits the selection, the menu item shows that script’s name instead.

The selected files arrive as mash.event.files, and the first as mash.event.file. The answers to the Input questions arrive in mash.event.input. There is no event beyond that: mash.event.user is the person who ran it.

files = mash.event.files
if not files or count(files) == 0
printline "Select at least one file first."
return
end
each files as doc
printline "Selected: {{doc.name}} ({{doc.size}} bytes)"
end

Choosing the entry opens a panel. It asks the Input questions, runs the script, and shows what the script prints as it prints it.

Two people are involved, and it matters which rights apply.

  • If the script’s owner is an ordinary user, the run is limited to what the owner may do, even when someone else picks it. The script can’t do more than its owner could.
  • If the owner is an administrator (someone who can manage MaSH, or a built-in account), the run isn’t limited that way, and the selected files open as the person who clicked.

Either way, the person must hold Use Mashlet on the entry to run it at all. See Who a script runs as for the rule in full.

An entry from this tab has a 60-second limit on Foldr Cloud. On an appliance, MASH_TIMEOUT can raise it.

A share’s own settings can carry action-menu scripts too. They show only for files in that share, next to the global ones.