Add an iPhone call log to iCal via AppleScript
Tue, Aug 26 2008 at 7:30AM PDT • Contributed by: jedmtnman
Tue, Aug 26 2008 at 7:30AM PDT • Contributed by: jedmtnman
If you're like me, it is often nice to know the time spent on a call (especially if you charge your services by the minute) and even though the cheapest cell phones out there can tell you the time you were just on the phone, that data is buried deep in iPhone's records and unaccessible from the touch GUI.
I have been using a script created in ruby called calllog2ical, which you can download from this page at Google Code. The install process is a breeze and it can be called from Terminal. After using the script for about a week, I decided it would be nicer to use an AppleScript to access the shell script, and so I wrote one. Its all of one line and goes like this:
Notes:
I have been using a script created in ruby called calllog2ical, which you can download from this page at Google Code. The install process is a breeze and it can be called from Terminal. After using the script for about a week, I decided it would be nicer to use an AppleScript to access the shell script, and so I wrote one. Its all of one line and goes like this:
do shell script "/usr/local/bin/calllog2ical.rb -v0 iPhone\\ Call\\ Log"
In the above code, the calendar I am syncing to is iPhone Call Log.
Notes:
- In order to get the AppleScript to work, I had to add to the script call the bin directory that contains the script, and then double escape the spaces (with two backslashes, as seen above) in the iCal calendar's name. You can find where your ruby script is installed with the which command in terminal: which calllog2ical.rb.
- I then created a folder called Scripts in my user's Library » iTunes directory, and placed my newly- created AppleScript in that folder. Magically, when I open iTunes, a script menu appears next to the help menu bar, and when syncing my phone, I can call that script and my entire call log appears in iCal.
- Finally, if you open the ruby script with a generic text editor like Text Wrangler, and scroll down near the bottom, you will find (at line 267) the call to make the note of the iCal event the duration of the call in seconds. Tweaking this line will give you the call in minutes:
newEvent.setNotes("Length of call: " + call.duration.to_s + " seconds")
•
[17,360 views]
