Skip to content

Tutorial

MaSH stands for “Making Stuff Happen”. It’s the scripting language built into Foldr. You use it to automate the jobs people do by hand: filing documents into folders, filling in custom fields, sending a message when a file arrives, tidying up on a schedule.

This tutorial teaches the language by building up small scripts. Read it in order. Each chapter uses only what the earlier ones introduced.

You don’t need to be a programmer. If you’ve written a spreadsheet formula or a simple macro, you know enough to start.

  • A Foldr account that can open Settings > MaSH. Ask your administrator if you can’t see it.
  • About twenty minutes for each chapter.

Chapters 1 to 6 need nothing but the editor. They print their results, so you can run every example on its own. Chapters 7 to 10 touch shares, events, mail and web services. Those examples are marked so you know they need a real share or an outside service, and you can read them without running them.

  1. Your first script: where you write MaSH, and how to run it.
  2. Values and arithmetic: text, numbers and variables.
  3. Decisions and loops: if, each, while.
  4. Collections: arrays, dictionaries and mash.collect.
  5. Blocks: reusable pieces of script.
  6. When things go wrong: error blocks, fail and exit.
  7. Files and folders: mash.files and File objects.
  8. Custom fields: reading and writing a file’s fields.
  9. Reacting to events: scripts that run when something happens.
  10. Talking to the outside world: JSON, web requests and mail.
  11. Putting it together: a small filing workflow.
  12. Where next: the reference, and the real scripts to learn from.

A block of MaSH is followed by what it prints:

printline "This is an example"
This is an example

When you see a block with no output, it runs but prints nothing. The examples in this tutorial are checked automatically against the real language, so what you read here is what you’ll see.