Can I make an AppleScript to display Uptime in dialog?

Jasoco

Video Gamer/Collector
Well, can I? So I can doubleclick on it and it will pop up a box with all the info that pops up when I type Uptime in the terminal. Without having to launch Terminal.
 
display dialog (Shell "uptime") buttons {"OK"}


of course, if you want an applet that you can double-click rather than run in script menu, you'll have to save as compiled
 
I believe the above script requires a scripting addition to be installed, OSX Power Additions Lite. I believe Shell is one of its commands. I don't know if there is anyway to do this with the standard Applescript (while Terminal is scriptable, its not very full featured). Try downloading and installing it, though I can't promise this will help (I don't have the software installed on this machine to check).

http://www.vampiresoft.com/Products/MacOS/osxpoweraddos.html
 
I got this one to work for me. Save as an application and all you have to do is double click it. :D

Code:
tell application "Terminal"
	do script with command "uptime"
	delay 1
	set the_results to contents of window 1
	close every window
end tell
display dialog paragraph 4 of the_results buttons {"OK"}
 
Back
Top