iSync’s .mac Icon Redux

This began to irritate me, much more than it should for a supposedly rational being. Why should someone need the Developers Tools just to shift a user interface element 80 pixels to the left?

Well, after a bit of poking around with the Nib files embedded in iSync, it became clear that we didn’t need the Developer Tools at all. Using the plutil command we can convert a Nib file into XML format, it seems like it’s just another plist file (be careful of the line wrapping):

$ cd /Applications/
$ cp English.lproj/iSyncMain.nib/keyedobjects.nib /tmp
$ cd /tmp
$ plutil -convert xml1 keyedobjects.nib
$ grep '{{.*}}' keyedobjects.nib
  <string>{{58, 180}, {425, 544}}</string>
  <string>{{10, 460}, {405, 80}}</string>
  <string>{{9, 3}, {388, 14}}</string>
  <string>{{0, 20}, {425, 434}}</string>
  <string>{{1, 9}, {425, 544}}</string>
  <string>{{0, 0}, {1440, 878}}</string>
  <string>{{-2, -4}, {429, 20}}</string>
  <string>{{28, 54}, {178, 32}}</string>
  <string>{{-15, -34}, {425, 86}}</string>

So the information is in there after all! (the line in bold is the line we’re looking for). Now a quick modification:

$ mv keyedobjects.nib keyedobjects.BACKUP
$ sed 's/{{10, 460}, {405, 80}}/{{-70, 460}, {485, 80}}/' keyedobjects.BACKUP > keyedobjects.nib
$ plutil -convert -binary1 keyedobjects.nib
$ cd /Applications/
$ cp tmp/keyedobjects.nib English.lproj/iSyncMain.nib/

Combine this with the power of AppleScript, and SyncScrubber is born! Originally I was planning to use do shell script along with plutil and sed but then I discovered AppleScript’s property list object which lets you read and change values in a property list, be it in binary or XML form.

Interestingly enough, Apple themselves say that “Prior to Mac OS X v10.5, property lists could only be read using the related suites in the System Events application. In Leopard, property list files can be created and edited.”

Well, apparently that’s not true, this snippet of AppleScript code works just fine on OS X 10.4.11. Here I’m expecting a certain named item “pItem” to have a certain index “pIndex”, and I want to set it to a value “myValue” (again watch the line wrapping):

tell application "System Events"
  set theProps to get property list file plistfile
  set theValue to property list item pIndex of property list item pItem of theProps
  set value of theValue to myValue
end tell

That last line, set value of theValue to myValue actually updates the value in the plist or nib file, amazing!

I’ve put this into an application which you can download here, it’s free to use. I’ll post all the code at some stage, but I’ve fussed over this enough and I want to get it out there.

If you have problems or questions about it, let me know, especially if you have a non-English localized version of iSync (if such a thing exists).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s