One of an occasional series of ways I make my Macintosh weep. For Pete’s sake, I don’t recommend that you do this, and if you do it’s at your own risk. This is meant more as a tutorial for ways you can hack your Mac.
The problem: I use Stefan Fuerst’s wonderful TimeLog software to keep track of my billable and other work time. It’s great in many respects, but it had one behavior that really bugged me: while it’s running, iCal quits. Which meant that 10 times a day I was waiting 30 seconds for iCal to launch before I could edit my calendar. (Of course, I can always view my upcoming calendar because I use Karl Goiser’s wonderful iCalViewer on my Desktop.)
So I wrote Stefan, and he wrote me back in something like 90 seconds despite it being 4 AM in Switzerland, and it turns out that the problem isn’t with TimeLog, but rather with iCal—long story short, if you run iCal and TimeLog concurrently, iCal can overwrite your TimeLog calendars.
So the trick is to set up TimeLog and iCal so they use different file spaces, but so you can still see your TimeLog calendars in iCal. Luckily, we can do this, and all we have to do is set up a calendar server, multiple user spaces, and hack some program resources. No problem. Note that these steps will work just fine in case you want to use iCal to track multiple calendar spaces that you need to keep separate from one another.
Step one: we need a new user space. Head over to
, and create a new account called “Timelogs”. Make it an administrative account, that will be useful later. If you want to be really anal about it, you can copy the TimeLog icon and paste it into the user picture. (You can guess what I’ve done.) The icon for any file can be copied by highlighting it in the window in the Finder.If you haven’t already, this is an excellent time to turn on
in , because we’ll be doing some switching back and forth for a while.Step two: hack TimeLog so it doesn’t quit iCal anymore. Go to the application in the Finder, control-click on the icon, and choose
. In the window that pops up, go to . That’s an AppleScript application; open it up in Script Editor (by dragging it on top of the Script Editor icon—if you double-click on it, you’ll just quit iCal).Replace the script with the following:
set whoami to do shell script "whoami"
if whoami = "timelogs" then
try
tell application "iCal"
quit
end tell
end try
end if
So now the script will only quit iCal while you’re actually logged in as the Timelogs user. Save it.
on the file, scroll down to , change the group to “admin” and the access to “Read & Write”.- Note: naturally, this hacked script will be overwritten if you update TimeLog, so you’ll need to repeat this step next time Stefan releases an upgrade.
Step three: now that we’ve hacked TimeLog, we want to make sure that we can’t run it anymore. That is, if we launch TimeLog in our main user account, we run the risk of having it conflict with iCal and eating some calendar data. So we want to restrict TimeLog to only running under the Timelogs user account.
In the Finder, navigate to
from your primary account (which I’m assuming is an administrative user). On your Desktop, create a new folder called , and drag that into the Timelogs user folder. You’ll be asked for your administrative password. Now drag the TimeLog application into that folder. TimeLog can now only be launched by the Timelogs user.Step four: fast-user switch over to the Timelogs account. You’ll have a brand-spanking new iCal and TimeLog running over there (and you’ll have to re-enter your TimeLog registration code). Set up everything just the way you like it.
Step five is optional, if you want to have your TimeLog calendars visible in your regular iCal. The whole point of this is to lock away those calendars in a new user space—but you can still view them by using iCal calendar sharing.
So to do this, we need a calendar server. We can do that with WebDAV and the built-in Apache web server. Follow Erik Ray’s instructions in his article on MacDevCenter, and you’re good to go. Turn on in , and leave it on forever.
Now go ahead and share your TimeLog calendars; i.e., from the Timelogs user’s iCal, publish the calendars you’ll be using. Then log out as the Timelogs user.
Step six: switch back to your primary user space. Subscribe your primary iCal to the calendars you published; boom, your calendars are now visible (but not editable) in your regular iCal.
Step seven: so now we want to actually use TimeLog in our primary user account. But only the Timelogs user can launch the application. So we need an AppleScript to do that as if we were logged in as that user. Like this one:
do shell script "sudo -u timelogs /Users/timelogs/Applications/TimeLog.app/Contents/MacOS/TimeLog &> /dev/null &" user name "username" password "password" with administrator privileges
Copy and paste that into a Script Editor window, all as one line with no carriage returns. Replace “username” and “password” with your admin equivalents, and leave the quotes in, AppleScript needs them. Save this as an application (a checkbox in the save window).
- Note: for security purposes, you might not want to save your admin password in a file that’s human-readable. If you check the “save as run-only” checkbox before saving, Steve Jobs himself won’t be able to get your password out of this file.
Step eight: Run the new AppleScript application, and you’re done. You now have an iCal-safe TimeLog running. If you like, you can put the AppleScript launch application where you used to keep your original TimeLog application, and you can also put that into your login items if you want this to launch at startup.
That’s it, except for the passel of AppleScripts I’ve written to make this hack more useful in production. Those are available in the accompanying software post, JTLSA.
Hi, there,
Very nice and clear “hack” for this problem.
However there are 2 points in wich I changed from your solution:
1: If you have a .Mac account, you can use that as a publisher of iCal.
2: If you have a lot of different clients, like I do, using this solution results in either have a duplicate of your addressbook. Which will be a nightmare to maintain, or do what I did: Made the folder AddressBook writeble to the group admin. The user timelogs is part of it. Next create a symbollic link from your main account into your timelogs account. And presto 1 database for AddressBook, which TimeLog can read!
Greetings
Arnold
Thanks, Arnold. I left out the .Mac solution (or any other iCal publishing site) in order to make this portable on laptops that might sometimes be offline.
Likewise, I’m not sure about the ramifications of having two Address Book instances writing to the same database. So if you use your linking strategy, I recommend you AppleScript it to make sure that only one is open at a time. Obviously, if you lose any AB data you’ll be up a creek.