You are on page 1of 19

Pipe Tutorial

Simple Scripts
Using Pipe as a Service
Creating Images
Using Templates
External Editors
The Script Library

Start

Simple Scripts

Back

Table of Contents

Start

Simple Scripts
Simple Scripts convert
text data from your input
field to the output field
An environment variable
can be used to control the
direction of the
conversion.

#!/bin/sh
if [ "$PIPE_REVERSE_TRANSFORM" == "1" ]; then

ARGS="-d"
fi
/usr/bin/openssl base64 $ARGS

This example translates


text into a base-64
encoded string.

Back

Table of Contents

Next

The input text contained in


the green box is processed
and transformed into the
base-64 encoded string in
the blue box.

hello, world!

By clicking Output to Input


and then Toggle Direction
you can reverse the
conversion.

Back

Table of Contents

aGVsbG8sIHdvcmxkIQo=

Next

Using Pipe as a Service

Back

Table of Contents

Start

Using Pipe as a Service


Pipe can be used as a system wide service.
You can send data to your scripts from any
application that supports the OS X services.
Data outputted from your scripts will be
automatically inserted where you need it.

Back

Table of Contents

Next

Using Pipe as a Service


For the purpose of this tutorial we assume, that you have
a grandmother, who speaks only ROT-13. One lovely day
you receive the following eMail:
Qrne tenaqfba,
V unir znqr lbhe snibhevgr pnxr. V ubcr lbh pna ivfvg
zr sbe grn gbzbeebj.
Ybir,
Tenaqzn

Now what to do?

Back

Table of Contents

Next

Easy. Simply hit Reply in your


mail program, highlight the text
and select the menu option
Services Pipe Through
Script

Click OK and the selected


text portion is instantly
replaced with the translated
text.

Back

Table of Contents

Next

Using Pipe as a Service


To accept this wonderful invitation, just
finish writing your mail.
Select your text and pipe it through the
ROT-13 script again, this time checking the
box Reverse Transformation.
Your reply will be replaced by the converted
text.
Dont forget to visit your grandma tomorrow!

Back

Table of Contents

Next

Creating Images

Back

Table of Contents

Start

Creating Images
Pipe can also display images as the output
of your scripts.
From the menu choose Script Show
Output As Image.
This can be used to render text into
graphics, create diagrams from input data or,
for the lack of a better example, create a
screenshot.

Back

Table of Contents

Next

Creating Images
Pipes Script Library
also includes a sample
script that generates
charts and a simple
function plotter.

Back

Table of Contents

Next

Using Templates

Back

Table of Contents

Start

Using Templates
You can save scripts as templates to quickly
recreate new files with all its options already
pre-set.
Templates will be saved in a designated path in
~/Library/Application Support/Pipe/Templates.
All templates that are saved there will show up
in the menu File New with Template.
To save a script as a template choose Save as
Template from the File menu.

Back

Table of Contents

Next

External Editors

Back

Table of Contents

Start

External Editors
You can use your own favourite editor to
edit both script and input.
Input in these text entry fields will be
disabled while its contents is being edited in
an external application.
If you save the text in the editor, the script
will be automatically executed in Pipe if
Run scripts automatically is activated in
the Preferences.

Back

Table of Contents

Next

The Script Library

Back

Table of Contents

Start

The Script Library


Pipe already comes with a collection of
useful scripts that you can use immediately.
You only need to copy the scripts you want
to your hard disk and add it to Pipes Script
Browser by dragging its icon onto the list of
scripts.

Back

Table of Contents

Next

The Script Library

Back

Table of Contents