PDA

View Full Version : Executing AppleScripts from the Squeezebox?



Sune
2008-02-17, 11:46
Hi all,

Is there a way to execute applescripts from the Squeezebox / SlimServer Web interface?

I'd love to make a script that ejects an audio CD that has been playing in iTunes / Broadcasted via NiceCast / Streamed to my Squeezebox....everything except the eject is automated on my headless Mac Mini...which does not have an eject button.

Essentially what is need is a way to make an AppleScript reachable from my Squeezebox Remote, and preferrably also from the iPeng skin.

HEEELP!

Sune

danco
2008-02-17, 12:22
You can run shell scripts from the Squeezebox or web interface; AppleScripts can't be run directly..

However, a shell script can be written to run an AppleScript.

Can you write the AppleScript yourself? If not, I think I can work it out.

The shell script syntax is either

osascript filename

or

osascript -e 'first line of script' -e 'second line of script' etc

I can give more precise details of writing a shell script if you need (or search the forums for "Jiggler", where I give an example).

You will need either the Execute Script plugin or the Shutdown Server plugin (which can actually run any shell script).

Sune
2008-02-17, 13:24
Cool. Thought I needed some kind of plug-in to do this, and also found the parts about the shell-scripts. Had not thought of the fact, that I could just call an applescript though.

I suck at AppleScripting, but I guess I can simply record an action and clean it up afterwards. That'll work out, or I'll get right back here.

Another question reg. AppleScript. I'll need my headless server to shut down in the night automatically, and often find that such process can be hindered by applications that refuse to quit.

Do you know if there is a way to make a script that "force quits" all open applications if they refuse to shut down?