Scripting in iOS
Imagine that every app on your iPhone offered up its best features as little blocks that YOU could put together to create the apps YOU need in about the same amount of time it takes you to set a reminder or look up an address. Maybe we’ll see something like this soon!
Application scripting has a long history. The Mac, for instance, has had AppleScript since 1993. Even today, many apps on the Mac (Acorn and Transmit, for instance) make their features available for users to combine with AppleScript to create personalized workflows. Apple kicked it up a notch with Automator in 2005 making it much easier to combine services from a variety of apps. See Sal Soghoian’s site for some great examples of what’s possible – create a tour in Google Earth, convert a bunch of essays into audio files for your commute.
AppleScript isn’t alone. MIT’s Scratch is a graphical programming language with a focus on usability that is now available for Android as Google App Inventor. It shares the Android platform with a few other scripting tools – Locale, for instance, will trigger functionality on your Android phone when a set criteria happens (“Lock my screen when I leave my home or office”, etc). If This Than That has built up an excellent set of scriptable web services giving you the ability to automate the internet (“SMS me AAPL drops below $500”, “When I star items in Google Reader, send them to Instapaper”). If you’ve ever used Outlook’s Inbox Assistant, you probably have an idea of how a simple interface can give you a lot more control of your applications.
So what does this have to do with iOS? If Apple and the iOS developer community embraced scripting, here are some use cases that come to mind:
- Clock + Spotify – Give Spotify a sleep feature – turn it off after 30 minutes.
- Shazam + Spotify – Find out what I’m listening to and play the whole album.
- Settings + Settings + Settings + Settings – When I click a button on my home screen, lower my brightness, turn all notification sounds off (but leave phone sound on in case of emergency), turn on my 7AM alarm – Now my phone is in night mode!
- iMovie + Camera + Weather + Image Editor + Clock – During a blizzard, take a picture of the street every 5 minutes (with the temperature super-imposed) for 3 hours and combine the frames into a movie.
- Settings + Instagram – When any of my friends posts an instagram image, use it for my home screen background.
- Maps + SMS + Clock – Text my kids’ current location every few minutes while they are trick-or-treating.
- Stock + Settings + Notifications – If AAPL drops below $500, turn off mute, turn the volume way up and sound an alarm.
- Phone + Harvest – When a call comes in from a client, make a note of the time and duration in Harvest.
- Wifi Settings + Instacast – As soon as wifi is connected, start downloading the latest podcasts.
- Alarm + Notification + TuneIn Radio – When it’s time for my favorite radio show to start, notify me with the option to start TuneIn Radio on the correct station.
I’m sure some of these exact recipes are available in a single app, today. The trick or treat example could be achieved with Find My Friends or Glympse, for instance. But scripting would let you customize the ingredients to get exactly what you want.
Apple and the iOS community has been building a lot of bite-sized apps that are highly specialized. Each of these apps has something to offer as a building block in a highly scriptable device. Scripting on iOS (done right) could bring us a more personalized, streamlined and accessible mobile computer.
What would you make?
Great Mac Software
Here are some of the apps I use frequently.
- LittleSnapper is my favorite screen capture app. Like many similar apps, it stores a library of your captures and has hot keys for common use cases.
- Things is a todo app from Cultured Code. It’s a little expensive (you have to purchase the desktop, iPhone and iPad apps separately), but it adds the right amount of structure without getting in the way.
- Soulver is a tape-based calculator with the edit-ability of a spreadsheet. Watch the video before you put your $ down. If you find yourself making a lot of calculations for a project and you want to see them all at once – Soulver might be exactly what you want.
- DropBox is great for sharing files with other people, other computers and even your iPhone.
- I use Acorn for image editing (including creating the image at the top of this post). I like it, but I know some prefer Pixelmator and others, Photoshop. They are all great options.
- Fantastical sits in your menu bar, showing today’s date. Click on it to get fast, interactive access to your iCal calendar. I use it most for it’s large, drop down month view.
- Boom at http://www.globaldelight.com/boom/index.html is a fantastic utility that nearly doubles the volume of your MacBook. It’s incredible for listening to podcasts, music and video when the sounds is just a little to quiet. A recent software update fixed my only concern with Boom – it no longer crashes.
- I prefer VMWare Fusion over Parallels for running Windows apps on my Mac. Historically, it eats less battery life, in my experience.
- iStat Menus puts CPU utilization, memory usage and other computer-health metrics in your menu bar, along with a very nice calendar.
- Stock Menulet shows one or more stock prices in your menu bar.
- Hyperdock emulates some of Windows 7’s best features. Drag a window to the side of your screen and it will snap-resize to fill exactly half of your desktop. Move your mouse over an app’s icon in the dock to see a preview of the windows owned by that app.
- DaisyDisk: if your hard drive fills up quickly and you find yourself cleaning out media files or downloads frequently, DaisyDisk can help. Like many other tools, it helps you visualize where all your space is going, but it’s much more fun to use than its cousins.
- xScope provides awesome tools for measuring distances and areas on screen. Magnifying glass, guide lines, etc. I use this a lot.
- Hues replaces your color picker with something much more useful. Save more custom colors, work with more color formats – it even has better copy/paste and an eye dropper!
- Transmit is great for FTP, S3, etc.
- iTerm 2 is a great replacement for the built-in Terminal. Split panes, colored output, scriptability. Good stuff!
Some interesting reading this morning.
Shirt Pocket software is working on fixes for SuperDuper!, the state-of-the-art backup software for OS X. The biggest issue right now seems to be the unconventional system that Apple is using for hiding file compression from applications (which seems to be necessary for backwards compatibility). The great news is that even without these fixes, SuperDuper! is not experiencing any data loss. Dave Nanian’s article is here.
If you want to learn more about Snow Leopard’s file compression or ANYTHING ELSE, check out John Siracusa’s massive 23 page review at Ars Technica. While I understand that some users are finding Snow Leopard more of a Service Pack than a new OS, I have to say that I’m loving some of the features. The new changes to Expose alone are worth the $30 bucks to me. You can read up on the Expose features and other cool bits over on the TidBits blog. Try hitting the Expose key and then tabbing through your applications. FUN!
It sounds like the new hero Massively Multiplayer game, Champions Online is off to a rough start. They ratcheted down the effectiveness of players who participated in the beta. This is called a ‘nerf’ in the MMO world. Matt Franklin contrasts this with the rate at which the lead MMO (World of Warcraft) is making game play (especially beginner game play) easier and easier.
This Commodore 64 Visual Debugger is incredible. You start out with a window that shows EVERY address in memory and then zoom in to look at specific locations. The waves of memory changes during file loading are neat! I can’t wait to run this thing while playing Paradroid!
Backblaze has a how-to article up about the homebrew storage solution they’ve created. 7 terabyte 4U servers for $7,867.
JKK checked out the Nokia N900. It merges the best work they’ve done on phones and the work they’ve done on Internet Tablets (Nokia 770, N800, N810). It looks great and has a lot of power in the OS (Linux/Maemo) and the hardware. The Internet Tablet community must be really excited!
PAX, Penny-Arcade’s SOLD-OUT Video Game and Geekery convention (which started yesterday) just added 1,000 tickets.
Alex King spent some time these past few weeks trying to figure out which Network and BlackBerry Phone to use. He wanted to use a BlackBerry Bold, but ended up with a Tour on Verizon. His story is full of the idiosyncrasies of various carriers and devices. Part one. Part two.
Jack Shedd has some things to say about HTML 5. If you are watching the HTML 5 changes closely, Jack’s sentiments will likely resonate with you, including the frustration AND the respect for the team.
Lifehacker has an article on creating a Snow Leopard Hackintosh for $900 (plus the price of Snow Leopard standalone which is $169). I’d be interested in seeing a $500 model.
CSS 3D Demos
I’m looking forward to the rollout of CSS 3D to modern desktop web browsers (and, hopefully, mobile web browsers).
This demo (clearly inspired by Cooliris) shows an interactive HTML document being manipulated in 3D.
Simon Fraser has a detailed explanation of CSS 3D’s capabilities.
And here is a video showing off CSS 3D Rotation.
Very cool stuff!
Python + OS X + Arduino + BlinkM
I have a bunch of BlinkMs and an Arduino from an old project and I spent some time with them this weekend. This time, I used Python on a Mac to connect. I learned a little in the process, so I thought I’d share.
1. I used darwinports‘ Python2.4 and the pyserial library.
2. On the Arduino, I flashed the BlinkMCommunicator code available here.
3. When writing to the BlinkM’s eeprom, you need to pause briefly before sending another command.
4. The attached code uses decode(“hex”). I’ll explain that design choice later.
5. The code assumes you have 3 BlinkM’s hooked up to the Arduino with their addresses set as 1, 2 and 3.
import serial import time def toBlinkM (ser, command): print ">\t Sending "+command ser.write(command.decode("hex")) print ">\t\t Sent "+command def setBlinkMToPlaySimpleScript (ser, address, color1, color2, color3, color4, duration, fadespeed): # example: write line 0 of script 0 on BlinkM 1 # 01 Start code # 01 BlinkM address # 08 bytes to send # 00 bytes to receive # 57 command: write line # 00 script number # 00 line number # 20 duration # 63 fade # 20 R # 20 G # 00 B print ("> Playing Simple Script on "+address) toBlinkM(ser, "01"+address+"0800570000"+duration+"63"+color1) time.sleep (.2) toBlinkM(ser, "01"+address+"0800570001"+duration+"63"+color2) time.sleep (.2) toBlinkM(ser, "01"+address+"0800570002"+duration+"63"+color3) time.sleep (.2) toBlinkM(ser, "01"+address+"0800570003"+duration+"63"+color4) time.sleep (.2) # last line: play script 0 1 time toBlinkM(ser, "01"+address+"0800570004"+"00"+"70"+"000100") time.sleep (.2) # set script id 0 to a len. of 5, 1 repeats toBlinkM(ser, "01"+address+"04004C000501") time.sleep (.2) # set fade speed toBlinkM(ser, "01"+address+"020066"+fadespeed) time.sleep (.2) # play script id 0 toBlinkM(ser, "01"+address+"040070008000") time.sleep (.2) ser = serial.Serial('/dev/tty.usbserial-A4001lcU',19200, timeout=1) counter = 0 print "> Waiting for Arduino." while 1: serialline = ser.readline() if (serialline): print serialline.strip() if ('ready' in serialline): break print "> Arduino ready." # tell #1 to stop animating toBlinkM(ser, "010101006f") # tell #1 to show only green and red at 1 bright toBlinkM(ser, "0101040063010100") # tell #2 to stop animating toBlinkM(ser, "010201006f") # tell #2 to show only blue and green at 1 bright toBlinkM(ser, "0102040063000101") # tell #3 to stop animating toBlinkM(ser, "010301006f") # tell #3 to show only red at 3 bright toBlinkM(ser, "0103040063030000") time.sleep (10) setBlinkMToPlaySimpleScript(ser,"01","404040","FF0000","0000FF","FF0000","05","10") setBlinkMToPlaySimpleScript(ser,"02","400000","FF0000","800000","FF0000","05","10") setBlinkMToPlaySimpleScript(ser,"03","000000","FF0000","000000","FF0000","20","10")