Display system uptime in a Finder dialog

Mar 18, '08 07:30:03AM

Contributed by: The Moose

I was thinking that there must be an easier way than going to Terminal and typing uptime in order to find out how long my machine had been up. So I wrote a wee AppleScript that gives the answer in the form of a Finder dialog window. Stick this into Script Editor, and save it as Application (or Application Bundle).

set output to do shell script "uptime"

tell application "Finder"
    display dialog output buttons {"OK"} default button 1
end tell
If you wish, you can then add a shortcut to it from your launcher. Voila, uptime and load averages at your findertips (literally).

[robg adds: This is a very simple hint, but one that demonstrates to new AppleScript users how to display the output from any Terminal command in a dialog. For uptime, and many other Terminal commands whose output I'd like to see on occasion (such as the results of the last Time Machine backup), I use GeekTool, as described in this Pick of the Week entry. (And yes, that feature will return in some form shortly...).]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080310185351225