Mac – Log software usage time on Mac OS 9 (Oct. 1999)

applescriptbashmac

I'm needing to log the time a user spends inside of an application in Mac OS 9. I created a simple bash script "launcher" to do this, but then discovered OS 9 doesn't have bash installed. Here is the bash script I wrote for reference.

#!/bin/bash

APP="TextEdit"  
LOG_LOCATION=~/Desktop/textedit-usage.log

run_app() {
    USER=`whoami`
    START_TIME=`date`
    echo "START - $APP - $USER - $START_TIME" >> $LOG_LOCATION
    Open -W -a $APP
    END_TIME=`date`
    echo "END - $APP - $USER - $END_TIME" >> $LOG_LOCATION
}

run_app &

It creates a simple log file that looks something like this:

START - TextEdit - john - Tue Jan  7 15:14:55 EST 2014
END - TextEdit - john - Tue Jan  7 15:15:48 EST 2014

Is there a way to port this script to OS 9? I was thinking AppleScript might work, but am having trouble finding documentation for the specific version used in OS 9. I don't even know where to start.

Best Answer

What I would do is install Mac OS X 10.5 Leopard, on a PowerPC PowerMac and then install OS 9 into the Classic Environment, and have your user run their application there. You can still find new and full retail versions of Leopard with the licensing intact, and online support is still available.

Then, I'd use your bash script (with a possibly needed slight modification to track use of the entire Classic Environment rather than the specific application). ;-)