Nicholas Pike

Like nailing jelly to a wall…

iPhone/iPod Touch: Timed/Delayed Screenshot

without comments

Erica Sadun provides a slew of command line applications for the OS X mobile operating system - my favorite being her series of screenshot applications.

I just have one problem: Theres no easy way to take a screenshot of an arbitrary screen directly from the device. (Unless you install the “Dock” launcher, which does not work for me)

I wrote the following two scripts to accomplish my task. From the terminal application you execute s.sh with a name for the screenshot:


% s.sh myscreenshot

You then have 10 seconds to exit the terminal, and navigate to the screen you want to take a picture of. After the screenshot has been taken and saved, a dialog will popup to tell you.

screenshot.sh

#!/bin/bash
###
# 2007 - Nicholas Pike
###

sleep 10
cd ~/Media/
mkdir screenshots
cd screenshots
snap $1
doAlert "Screenshot taken and saved to ~/Media/screenshots/$1"

s.sh

#!/bin/bash
###
# 2007 - Nicholas Pike
###

echo "A screenshot of your screen will be taken in 10 seconds. Leave the terminal and go to your desired screen now"
nohup /var/root/bin/screenshot.sh $1 2> /dev/null &

Both these scripts require EricasUtilities to be installed, and /var/root/bin to be on your path (otherwise the binaries in EricasUtilities wont work).

Save both scripts to /var/root/bin, chmod +x on both of them, and optionally rename s.sh to s for easier launching from the terminal.

All screenshots will be stored in ~/Media/screenshots (which will be created if it doesn’t already exist) - once you have the screenshot, you can use the fileToEmail utility included in EricasUtilities, or SendFile available via Installer.app

Written by npike

November 5th, 2007 at 3:46 pm

Posted in Projects, iphone, ipod

Leave a Reply