Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit HintSearchThe ForumsLinksStatsPollsFAQHeadlinesRSS 10,000+ hints and counting!
Add an iPhone call log to iCal via AppleScript
iPhone
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:
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")
[robg adds: I haven't tested this one.]
    •     [13,621 views]   
Rate this hint: [ 1  · 2  · 3  · 4  · 5 ] Average rating:

Hint Options

Add an iPhone call log to iCal via AppleScript | 18 comments | Create New Account
Click here to return to the 'Add an iPhone call log to iCal via AppleScript' hint
The following comments are owned by the person who posted them. This site is not responsible for what they say.
Add an iPhone call log to iCal via AppleScript
By: Canerow on Tue, Aug 26 2008 at 8:41AM PDT
I love the look of this but can't get it to work. I get a plist 'no such file or directory' message.
Anybody else?
What? No AppStore app for this?
By: jscotta on Tue, Aug 26 2008 at 9:05AM PDT
Wow, I hadn't realized that this would be an issue. And if it was, I was expecting to see an AppStore application for doing this and perhaps adding the hours automatically to some time billing application like an iPhone version of Billings.

---
Windows because I have to. OS X because I want to.
Add an iPhone call log to iCal via AppleScript
By: kilvano on Tue, Aug 26 2008 at 9:35AM PDT
-bash: syntax error near unexpected token `do'

I get this error. Im a newb at bashing
Add an iPhone call log to iCal via AppleScript
By: thetoolman on Tue, Aug 26 2008 at 10:09AM PDT
This is a great script, and really worked well on my first backup file import. However, in my next attempt, the script choked on some numbers that had a + sign in them. This error:
./calllog2ical.rb:102:in `match': invalid regular expression; there's no previous pattern, to which '+' would define cardinality at 1: /+1850878XXXX$/ (RegexpError)
Can you put in a filter to strip that out of the pattern match? The + is added when you look up a number in Google Maps and click to call from there. They are not necessarily numbers I would want to track, but there is no way to selectively delete items from the call history. Otherwise, great work!
Add an iPhone call log to iCal via AppleScript
By: Supp0rtLinux on Tue, Aug 26 2008 at 11:48AM PDT
This is great... one issue, though: for users with multiple numbers, it only seems to resolve the number to a name in my address book if they call is from or to the primary number and not a secondary number. I see a lot of entries on the calendar that say from or to and a phone number, but on my iPhone there are none from unknown numbers. Checking the first five shows that they called from their mobile number but in my address book their mobile number is listed second and either there work or home number is listed first. Any thoughts on a solution?
Add an iPhone call log to iCal via AppleScript
By: Supp0rtLinux on Tue, Aug 26 2008 at 11:52AM PDT
I appreciated being directed to line 267 for a solution to change the output from seconds to minutes, however when you pasted in <blockquote>newEvent.setNotes("Length of call: " + call.duration.to_s + " seconds")</blockquote> you copied the original text and not the modified text. I'm sure you're going to find very few Ruby users on this site, so it would help include the modified text.
<p>
Related, before changing anything, I noticed that all the seconds were divisible by minutes. In other words, they're all 60, 120, 180, etc. Granted cell companies record in minutes, not seconds, but the iPhone stores in seconds. It would be good if it showed the actual time... ie: 1hr, 4min, 17sec. or if by default it rounded up to the nearest minute as will be shown on our cellphone bills.
Add an iPhone call log to iCal via AppleScript
By: Supp0rtLinux on Tue, Aug 26 2008 at 12:14PM PDT
The correct code to have it show minutes instead of seconds is:
newEvent.setNotes("Length of call: " + (call.duration/60).to_s + " minutes")
Of course, this means that for 1 minute phone calls, it will say "1 minutes". So, perhaps a Ruby expert could add the logic for an if/then statement to say basically if less than or equal to 1 then "minute", else if greater than 1, then minutes. I could do this in a shell script or perl, but my Ruby skills are sub-par.

Also note that the file in /usr/local/bin is likely restricted. You will need to do something like

sudo vi /usr/local/bin/calllog2ical.rb
to be able to edit it properly.
Add an iPhone call log to iCal via AppleScript
By: zerografix on Wed, Aug 27 2008 at 5:51AM PDT
This could be even more useful if the ruby script Push call's from a specific address book group into different calendars
Add an iPhone call log to iCal via AppleScript
By: mac.by.jake on Thu, Dec 4 2008 at 1:15PM PST
I can't get this installed. I'm definitely don't know how to use terminal that well. The documentation reads for the install reads:

" In order to install on your system, cd into this install directory and enter the
# following command:
#
# sudo rake install
#
# This will install the calllog2ical.rb script into you /usr/local/bin directory
# and will install a simple launchd script."

I've completed the sudo rake install and then used the apple script mentioned in this post.

I'm getting the following error: "sh: /usr/local/bin/calllog2ical.rb: No such file or directory" when I use the applescript.

Obviously I'm not installing this properly when I use the terminal command.

Also from the posted install instruction I don't know what a simple launchd script is?

Any help is greatly appreciated.
Copyright © 2009 Mac Publishing LLC (Privacy PolicyContact Us
All trademarks and copyrights on this page are owned by their respective owners.

Visit other IDG sites:


Powered By Geeklog Created this page in 0.14 seconds