IOGraphica: It had to be done

I blame D’Arcy for this.

I kept thinking that it’d be interesting to take the results of IOGraphica and make it into stop motion animation. I looked for ways to download the image every X minutes but failed to find any way to do that in the program. I then thought, I could just remember to do this every hour or so. Then I realized I’d never do that even with a calendar reminder and besides, computers are supposed to do this stuff for me.

My next attempt was to search for AppleScripts that might have been written to do this for me. I wandered around quite a bit and found nothing. I then looked to see if IOGraphica had anything in the AppleScript Dictionary (While running Script Editor>File>Open Dictionary> choose the App you want). Nothing there.

Now I was stuck. I had invested nearly an hour last night searching for the answer. I saw a few other people interested in a solution. So, I dusted off a few of my old AppleScripting bookmarks in delicious1. The hassle with Applescripting applications without dictionaries is that you are pretty much shooting blind . . . unless you use the amazingly useful UI Browser. If AppleScripting were a class the teacher would ban the UI Browser. It not only helps you find the right interface elements, it also generates a chunk (or all) of the code for you. It basically did all the work for me.

If I wasn’t sticking to my goal of spending no more than an hour on #ds106 related nuttiness I’d do the following:

  • I’d figure out how to make the “Save” action happen in a way that didn’t change window focus. I remember doing this a long time ago but can’t seem to recall it now2.
  • I’d make a dialogue that lets you choose the folder for saving these images. As it is, just make a folder and save a first image to it in IOGraphica. It’ll remember that folder and save the rest to the same place.
  • I’d add some code to make it loop every X minutes. As it is, I just saved the script and activate it via iCal. If you look at the image below, you’ll see iCall lets you open files and call scripts as alarms3

The Script

You can also download this zip file and get the AppleScript in raw and application format.

activate application "IOGraph"
tell application "System Events"
get system attribute "sysv"
if result is greater than or equal to 4144 then -- Mac OS X 10.3.0
if UI elements enabled then
tell application process "IOGraph"
click checkbox 1 of window "IOGraph"
end tell
delay 1
keystroke return

display dialog "GUI Scripting is not enabled" & return & return & "Open System Preferences and check Enable Access for Assistive Devices in the Universal Access preference pane, then run this script again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
set current pane to pane ""
end tell
end if
end if
display dialog "This computer cannot run this script" & return & return & "The script uses GUI Scripting technology, which requires an upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons {"Quit"} default button "Quit"
end if
end tell

1 Currently for sale by owner yet it still works.

2 The script just activated, changed my focus from Chrome to IOgraphica and I started typing in the wrong window and then it saved before I could do anything. I will refund all licensing fees to anyone else who has this happen

3 I use this when I’m traveling as a backup alarm and have it open an mp3 with the computer set to full volume.

Comments on this post

  1. D'Arcy Norman said on January 13, 2011 at 3:15 pm

    awesome! automated imagedumps would be a great feature to have baked into iographica. I was looking forward to the growing blob resulting from the forgotten-cursor and 2 hour meeting…

    • Tom said on January 13, 2011 at 3:36 pm

      Yeah, I plan to do a whole day and see what that looks like. That’s only about 7 layers, spaced about 20 minutes apart.

  2. D'Arcy Norman said on January 13, 2011 at 3:44 pm

    it’d be nice if it properly understood multiple displays, instead of leaving the blank blankness on the right side…

    • Tom said on January 13, 2011 at 4:25 pm

      That is strange and then it randomly seems to add those big arcs. When I look at the program through the UI Browser it seems to show some hope for that in the future.

  3. Nico Carver said on May 17, 2013 at 12:35 pm

    Hey, I know this post is old, but I had the same idea (scripting IOGraph to make an image sequence), and found this blog post. I am trying to use this method to assess how well students follow computer-based instruction. I wanted to let you know that the improvements to the script you wanted are pretty easy. To make it save without changing window focus, just use the “launch” command instead of “activate” at the beginning. Then change the “keystroke return” line to “click button “Save” of window 1″. And if you want to make it even more fancy you can hide all windows when it is not saving with “set visible of process “IOGraph” to false” at the end. To make it loop every X minutes, just put the main tell block inside a repeat block (repeat X times…end repeat), and add a delay of X seconds right before the “end repeat” command.
    And an aside: I noticed after using Mountain Lion (10.8.3) for awhile, IOGraph wouldn’t launch anymore. Eventually, I figured out the reason: the app wants a Java 6 Runtime Environment, and I had moved on to Java 7. It was a nightmare rolling Java back manually because I ran into a bunch of crazy permissions issues. *end aside*
    Anyways, I thought your blog post was quite good. If you are interested in what I am doing with IOGraph, I’ve started documenting it here: MACAW overview.

    • Tom Woodward said on May 18, 2013 at 11:32 am


      Thank you for taking the time to comment and explain. It is people like yourself that make the Internet such a great place.