Run AppleScripts With the Wave of a Hand

Use an Arduino to control your Mac. In this Instructable I use a photoresistor to detect a shadow falling over it, then tell my Mac to run an AppleScript to play the next track on iTunes. This can be easily modified to run any AppleScript. It is a relatively easy, beginner level project for an Arduino Mac user.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Gather Materials

You will need:
a Mac computer
AppleScript Proxy from Tinker It! get it here:
Arduino. I used a Duemilanove
USB cable for Arduino
A photoresistor. Available from any electronics parts store. I got mine at RadioShack. Should cost about $3 for 5.
a 10k resistor. Color code: Brown Black Orange
some wire
LED if you don't have on on your Arduino. Though it's optional then, too.

Gather the above materials and install the AppleScript Proxy.

Step 2: Build the Circuit

Wire the 5V connection from the Arduino to one leg of the photoresistor. Connect the other leg to Analog input pin 0, and also to one leg of the 10k resistor. Now connect the other leg of the 10k resistor to the Arduino ground pin.

Step 3: Write an AppleScript.

Write the applescript you want to execute in the AppleScript Proxy program. I used:

tell application "iTunes" to play (next track)

and assigned it to character "A".

Step 4: Program the Arduino

Connect the Arduino to the computer and upload the program:

void setup(){
pinMode(13,OUTPUT); //I'm using the built in LED on pin 13 to light up whenever the shadow conidtion is met.
//This is optional. If you have an older Arduino, you may attach your own LED to pin 13.

void loop()
int lightlevel=analogRead(0); //reads the light level from the photoresistor and assigns it to the variable called lightlevel
delay(1000); //wait one second.
if (analogRead(0)<lightlevel-20) //if the light level changes by more than 20, it activates the shadow condition.
digitalWrite(13,HIGH); //turn LED on
Serial.print("A");//send signal to Mac, which interprets the A as a applescript command.

digitalWrite(13,LOW); //turns LED off.


/***Note: you have to stop the AppleScript program before uploading to the Arduino.

Step 5: Test It Out

Stop AppleScript before uploading the program to the Arduino. Upload the program, then start the AppleScript proxy. You may have to press the reset button on the Arduino to get them both working simultaneously.
It should work now!
Now hack it and see what else you can do!

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    12 Discussions


    8 years ago on Introduction

    After searching High and Low for and their Applescript proxy program, I have located it and posted it on my website

    This is a zip copy of the original software, with the items also extracted

    here is the applescript code.

    // Applescript Proxy test
    // Skip to the next song on itunes every 10 seconds
    void setup() {

    void loop() {

    The original program was titled "asproxy02.dmg"


    1 reply

    Reply 7 years ago on Introduction

    Hey, I'm really grateful for this. Please, if for some reason if you decide to take your site down in the future, try to upload it to mediafire or some other site. I've searched everywhere for this program, and it looks like yours is the last surviving link.


    Does anyone still have that Applescript Proxy available? It's no longer on the site links posted in the instructable (or the one in comments).



    9 years ago on Introduction

    the site changed domain names here is a new link

    but it now says page not found :(
    i'll email them and see if they still have it somewhere


    9 years ago on Introduction

     The Link doesn't Work I was wondering if You could sent me this app Thanks 


    10 years ago on Step 3

    what serial proxy are you using???????


    10 years ago on Introduction

    Hi, great tutorial. I made one of these with an IR sensor awhile back for a friend's installation art project. Every time someone came through the door of the art gallery, the sensor was tripped and a new track was played on itunes. I just thought the whole process was relatively easy and totally magic!