Skip to content

Instantly share code, notes, and snippets.

@vilcsak
Created February 2, 2012 22:38
Show Gist options
  • Save vilcsak/1726238 to your computer and use it in GitHub Desktop.
Save vilcsak/1726238 to your computer and use it in GitHub Desktop.
Automate capturing screenshots of the iPhone simulator
#!/bin/sh
# A) Run ./iphone-screenshot
# B) Type in the screenshot filename
# C) Click on the iPhone simulator
OUTPUTDIR=~/Desktop
TEMPFILE=iphone_screenshot_temp.png
echo "output filename:\c"
read -e OUTPUTFILE
osascript -e 'tell application "iPhone Simulator"' -e 'activate' -e 'end tell'
screencapture -iowW $OUTPUTDIR/$TEMPFILE
sips -c 960 640 $OUTPUTDIR/$TEMPFILE --out $OUTPUTDIR/$OUTPUTFILE
rm $OUTPUTDIR/$TEMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment