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.
What you’ll need
Section titled “What you’ll need”- 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.
The chapters
Section titled “The chapters”- Your first script: where you write MaSH, and how to run it.
- Values and arithmetic: text, numbers and variables.
- Decisions and loops:
if,each,while. - Collections: arrays, dictionaries and
mash.collect. - Blocks: reusable pieces of script.
- When things go wrong: error blocks,
failandexit. - Files and folders:
mash.filesand File objects. - Custom fields: reading and writing a file’s fields.
- Reacting to events: scripts that run when something happens.
- Talking to the outside world: JSON, web requests and mail.
- Putting it together: a small filing workflow.
- Where next: the reference, and the real scripts to learn from.
How the examples look
Section titled “How the examples look”A block of MaSH is followed by what it prints:
printline "This is an example"This is an exampleprintline("This is an example")This is an exampleWhen 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.