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
else
beep
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"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
else
beep
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.
Add a comment