Dear Danco,

I have something for you. It works on my mac, 10.5.8, doesn't work
extremely solid, but for this we'll have to wait on Gharris999 work.

The attached AppleScript accepts arguments: "on" (on forever), "off",
"quit" (exits Caffeine). It also accepts "on <number of seconds>" after
which Caffeine resets to off (this is a feature of Caffeine.)
So you can make a few commands as you like.

The AScript is attached below. Here is the source:
Code:
--------------------
    on run argv
        set Action to ""
        set Howlong to 0
        if the (count of argv) is not 0 then
                set Action to item 1 of argv
                if ((Action is "on") and (the (count of argv) is greater than 
1)) then
                        try
                                set Howlong to item 2 of argv as integer
                        end try
                end if
        end if
        if Action is "off" then
                tell application "Caffeine" to turn off
        else if Action is "on" then
                if Howlong is not 0 then
                        tell application "Caffeine" to turn on for Howlong
                else
                        tell application "Caffeine" to turn on
                end if
        else if Action is "quit" then
                tell application "Caffeine" to quit
        else
                tell application "System Events"
                        activate
                        display dialog "Unknown command." buttons {"Ok"} with 
icon stop
                end tell
        end if
        
  end run
  
--------------------


Get the attached zip and unzip it in /Applications/Utilities. **adapt
the path** if you don't like this location.

>From Terminal.app, check you can see your favorite coffee cup when you
type:
/usr/bin/osascript /Applications/Utilities/Caffeine-start-stop.scpt on
10 <return>

Then create a custom command in srvrPowerControl exactly as this (don't
add quotes, to my surprise the path seems indeed case insensitive but
this one is the true one.)

Custom command: Caffeine On
Command: /usr/bin/osascript
/Applications/Utilities/Caffeine-start-stop.scpt on 10

Then stop and start SBS to test from a clean slate.

Click "Caffeine On" and see the magic. After 10 seconds, the cup
empties.

'Download'
(http://srvrpowerctrl.googlecode.com/svn/SrvrPowerCtrl_beta.zip) the
plugin version Gordon has updated today in case of trouble.

If you want to edit the script, find the application named "Script
Editor".

Now. Don't tell me it doesn't work...


+-------------------------------------------------------------------+
|Filename: Caffeine-start-stop.scpt.zip                             |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=8586|
+-------------------------------------------------------------------+

-- 
epoch1970
------------------------------------------------------------------------
epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711
View this thread: http://forums.slimdevices.com/showthread.php?t=48521

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to