Category Archives: Apple

Minor Workflow Tip for Apple’s Preview

Screen Shot 2013-11-15 at 10.44.08 PM

I have a beautiful new laptop but I have yet to transfer over my actual drawing programs (Omnigraffle, Photoshop, Illustrator).

I had the need for a few icons for a website I’m working on and Keynote 6 is on this machine so I gave it a shot. I was very pleasantly surprised by the vector drawing tool. It’s different in a way that’s hard to articulate but I think people who are not familiar with vector drawing will really like it (and it probably won’t make the others too angry either).

One minor trick worth knowing is that if you copy items, vector items in this case, in Keynote (and other programs) and flip over to Preview, you can create a new image with just that selection by choosing File>New From Clipboard. That saves you a few steps and in this case gives you a nice PNG file with alpha transparencies with no effort.
Screen Shot 2013-11-15 at 10.46.41 PM

The results look something like this. No muss, no fuss. The icons are on Flickr if there of any interest and if you choose the original size you’ll get the PNG files with transparency.
Screen Shot 2013-11-15 at 10.46.54 PM


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.

Automator Action

Working Hard at Being Lazy with Automator

We just got a few new beautiful MacBook Pros in our office. I hated to see their desktops get all junked up like the old computers were- some people cover every inch of desktop until files overlap. So to amuse myself and to play around with Automator I decided I’d make something that

  1. makes a folder for the current date in your Documents folder
  2. takes all the crap off your desktop and puts it there
  3. then deletes all the stuff on your desktop

Automator Action

It took about 30 minutes to do, mainly because I couldn’t get the contents of the Finder to get refreshed before it selected what to delete 1. So I’d watch it copy to the right folder but then it’d erase the desktop and the contents of the Documents folder. It was strange but I eventually just broke the action into two parts 2.

It’s my first time using Automator so constructive criticism is welcome. I’m running 10.5.6 so I’ll say it works on that if both the app files are in the Applications folder and assuming your Documents folder is in the normal location. I put it in my Dock with a soap icon from Fight Club. You could also have iCal activate it automatically through the open file option under alarms.

iCal Alarm

If you’re interested in seeing how it works it’s all yours. I’ve included the App versions and the workflow versions of the files3

1 It’d have been faster to do in AppleScript despite my serious deficiencies there as well.

2 I’d be interested to hear smarter solutions

3 Just use the App versions by clicking on them. You can edit either one in Automator but the workflows will open there automatically.

iPod Touch Hack for iCal

I got an iPod Touch as a gift recently and was thrilled. As I started playing around with it I found I really wanted to be able to do more- like some of the stuff the iPhone could do. I especially wanted to be able to add to my calendar on the fly and to take notes.

So the first thing I did was use iJailbreak which required no brains on my part. It’s really just restarting a few times- no coding, no terminal, nothing difficult at all. That got me the iPhone apps and the option to install more programs later (assuming the next update doesn’t kill the iPod).

I still could not add events to iCal and that was nagging at me so I found this hack. All you’re doing is adding one small chunk of xml to a specific plist file (/System/Library/CoreServices/ on your iPod.

That turned out to be fairly easy as well.

  1. I got the IP address for my iPod (under Settings>WiFi>then click the blue arrow to the right of your network)
  2. I opened Cyberduck and opened a new connection using SFTP to that IP with the user name root and the password alpine
  3. I then navigated to /System/Library/CoreServices/ (Cyberduck may open your window in something other than the root view so make sure you start off there)
  4. Out of mild paranoia I copied the plist to my desktop and made a copy of it in case I screwed something up.
  5. Now I had to get that plist out of binary form and into xml that I could edit. I opened up Terminal (Applications>Utilities>Terminal) and typed the following plutil -convert xml1 I then dragged the file to the terminal window (which creates an automatic path to the file) and hit return. You’ll end up with something like plutil -convert xml1 /Users/teacher/Desktop/N45AP.plist if you’re dragging from your desktop. It will seem like nothing happened but it did.
  6. I then opened the plist in SubEthaEdit (I think any text editor will work) and added the lines as shown below, saved the file and quit SubEthaEdit.

  7. I now had to convert it back to binary form so I put the following into Terminal plutil -convert binary1 /Users/teacher/Desktop/N45AP.plist This path to the plist should be the same as the one you used earlier and once again, nothing seems to happen but if you try opening the file with your text editor now you’ll see it’s very different than before.
  8. The final step was sending the modified file back to the iPod using Cyberduck. You should be able to just drag and drop it. Then say it’s ok to overwrite the old file. I then restarted the iPod just to make sure.

It sounds like a lot but it was really easy and now I have what I want (which is what’s really important, right? :))

Standard disclaimer- I’m not saying you should do this. It’s just what I did. You’re an individual and should make your own decisions about your own property.