oriordan;502217 Wrote: 
> I would love to take you up on your offer of how to write the script you
> mention. I have downloaded Caffeine.

OK. Run Caffeine (so it is in your menu bar - you could have it run at
login) and then to turn it on or off you need a shell script that calls
an Applescript.

The shell script needed is

#! /bin/bash
osascript -e 'tell application "Caffeine" to turn on'


This can be written in any convenient text editor. But you need to make
sure that the quotes are not smart quotes, and that the text is saved as
plain text not rich text (and that line endings are Unix endings, which
is usually automatic).

Once the script has been saved, you need to make it open with Terminal
(easy by using Get Info from the Finder).

And then you need to make it executable. To do that, open Terminal,
type

chmod a+x (and a space) and then drag the file into the Terminal
window. By a bit of Mac magic this automatically types in the full path
to the file, so you don't need to type it manually.
Press return, and the file should now be executable by anyone. You can
check this by double-clicking and seeing what happens.

Similar shell script to turn Caffeine off.

The first line of the shell script just identifies what shell you are
using. Then the osascript command is an instruction to run an
Applescript. the -e flag says that the bit between quotes is the text of
one line of an Applescript. If you had a two-line Applescript you would
need to write osascript -e "line1" -e "line2" and so on for more lines.
For a long Applescript, one would do best to save it as a script file,
and call it by osascript scriptfile. 

Ask me if you need more help. I'm by no means an expert as regards
Applescript, but short scripts are usually easy to write and understand.


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

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to