Forums | MacLife

You are not logged in.

#1 2003-04-03 7:04 pm

maclaxguy
Member
Registered: 2002-07-17
Posts: 4

Seti Script

With a great deal of help from someone on the Apple Suport Forums, we have come up with this AppleScript which automatically executes the CLI version of seti whenever your screen saver is on.  Notes on what to change are at the bottom.

Code:

(* declare and set control variables *)
global running -- is seti cli running
set running to false
(* idler to check if screen saver running*)
on idle {}
    tell application "System Events"
        if name of every process contains "ScreenSaverEngine" then
            my startapp()
        else
            my stopapp()
        end if
    end tell
    return 15
end idle
(* sub routine to start application *)
on startapp()
    if running is false then
        log (running)
        ignoring application responses
            tell application "Terminal"
                do script "cd /Users/bfoster/zseti; /Users/bfoster/zseti/setiathome -nice -19 &"
            end tell
        end ignoring
        set running to true
    end if
    return
end startapp
(* sub routine to stop application *)
on stopapp()
    if running then
        ignoring application responses
            tell application "Terminal"
                do script "/Users/bfoster/bin/stop_seti"
                delay 4
                quit
            end tell
        end ignoring
        set running to false
    end if
    return
end stopapp
(* quiter to quit script app *)
on quit
    continue quit
end quit

What to Change::
1.) The line that says 'do script "cd /Users/bfoster/zseti; /Users/bfoster/zseti/setiathome -nice -19 &"'
   Change the directories to wherever you have your seti binary installed.  I have the nice value at -19, so it's a processor hog.  If you want more processor available, change this value.

2.)  The line that says 'do script "/Users/bfoster/bin/stop_seti"'
   If you do not already have a stop_seti shell script, create one with this in it (make it executable):

Code:

kill `cat /Users/bfoster/zseti/pid.sah`

Again, change the path to wherever your seti files are.


Save the script as an application that stays open, and then add it to your login items, and you're good to go.

-ben

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson