Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Applescripting Seti@ home Apps
[Submitted by phlbbrtn on Saturday]

In this hint I will show how to control the Darwin (command line) version of Seti@home using AppleScript. For this there are these ingredients:
Read the rest to find out how to control Seti@home with AppleScript.

When I first started using OS X one of the first things I did was to get the graphical Seti@home client and install it. It was veeeeeery slow in its beta version. I hear it's a little faster now.

But I ditched that version and got ahold of the Darwin command-line version. It works much faster, even if the learning curve to use it is steeper. The rest of this assumes you already have the Darwin Seti client on your computer.

The Mac OS X Power Additions package is some tools to integrate the Unix shell with AppleScript. In the package is the file called "OSX PowerAddOns Lite.osax" which is placed in the /Library/ScriptingAdditions folder.

Shell Scripts I have in my /Users "Home" directory a directory called "bin" which I have included in my command path in .cshrc. In ~/bin are the following three scripts.

1) Start Seti@home: "seti"
#!/bin/sh
cd /Users/phil/Setiathome/
setiathome -nice 20 >/dev/console
exit
2) Check Seti's progress: "prog"
#!/bin/sh
cat ~/Setiathome/state.sah | grep prog
3) Quit Seti@home: "kset"
#!/bin/sh
kill `ps aux | grep setiathome | grep -v grep | awk '{print $2}'`
exit 0
Create these scripts in a plain text editor and give them executable permissions (chmod 755) and place them in your command path. (FYI this is Unix Programming Lite. Mastery of the shell.)

Next, once you have verified that your commands work, open the ScriptEditor in /Applications/AppleScript. In the new script window type:
Shell "~/bin/seti"
Save the script as a "Compiled Script" in your ~/Library/Scripts folder. Name it what you want. Start a new script and type:
Shell "~/bin/prog"
Same as before. Save as compiled script and give it a name. Next script (quitting the process):
Shell "~/bin/kset"
Lastly in /Applications/AppleScript, there is a Script Runner app. Open this one up and click on the symbol in the little box and you will have a menu of all your compiled scripts.

Be careful of how you use scripting like this. Careless typing mistakes can cause damage to your filesystem. Use at your own risk, but it works quite nicely if you do everything right. Here's a screenshot showing everything working.
    •    
  • Currently 3.33 / 5
  You rated: 5 / 5 (3 votes cast)
 
[4,025 views]  

Applescripting Seti@ home | 1 comments | Create New Account
Click here to return to the 'Applescripting Seti@ home' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Update to hint
Authored by: Anonymous on Aug 25, '01 11:06:39PM

The instruction I gave about the "Start seti" script
contained an error. Not a fatal one, but it would
cause the Script Runner to freeze in place while
Seti@home was running. You would have had to kill
the Seti process from the terminal to get the Script
Runner back.

The solution was to edit the shell script "seti" and
put an ampersand at the end of line 3. It should
say:

setiathome -nice 20 >/dev/console &

This makes it a background process and frees the
Script Runner to function normally.



[ Reply to This | # ]