Dock Menu, Badge, Dialog Icon: How to do?
Dock Menu, Badge, Dialog Icon: How to do?
- Subject: Dock Menu, Badge, Dialog Icon: How to do?
- From: Christian Voelker <email@hidden>
- Date: Thu, 25 Jan 2007 15:41:45 +0100
Hello,
I am new to AppleScript. I am about to create a little
controller to start and stop my Tomcat Server. Yes,
there a some of them around, but I dont feel comfortable
with them. And no, I am not about to learn programming
from ground up and I dont want to deal with AppleScript
Studio if not absolutely required.
My idea is to have the Script sitting in the Dock,
requesting the admin password on startup only once,
offering a Dock menu with start and stop entries,
possibly also showing a red or green badge depending
on the status of the server.
Other solutions I have found are preference panes
consuming too much screen space, scripts storing
password rendering them unportable, scripts re-
quiring password entry for every single action,
scripts just killing the process and other nasty
stuff.
I have come this far. I have a Script saved as a
Programm Bundle containing a custom icon in Finder
and in Dock, showing the Dialog with hidden password
on startuo and executing the SystemStarter for one of
my two actions start and stop. The icon used so far
is a dummy.
set myPass to ""
set myAction to "start"
set myScript to ""
set myPass to display dialog "Bitte geben Sie Ihr Passwort ein:" with
icon 1 default answer "" with hidden answer
set myScript to "SystemStarter " & myAction & " Tomcat"
do shell script myScript password pass with administrator privileges
Next steps are creating the Dock menu, choosing different
values for myAction, Showing a badge, by surveillance of
existence of the .pid file in known location, using my
custom icon in the dialog instead of the generic icon.
Future extensions could be reading StartupItems and
offering similar options for all services installed
and supporting launchd as well using launchctl.
I have searched the web and this list for sample code
but have not been successful with this. Any hints
appreciated.
Bye, Christian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden