Is there a way to execute on applescript when a server becomes available? I am trying to execute a script when a server becomes available (a bit like when the OS detect the presence of a time capsule device and it starts the backup.)  I didn't find a simple way to attach an applescript to an system event. Is there a way?

I am not looking for anything that requires a compiler. I am simply looking at attaching to an OS event (a bit like "Folder Actions" I guess, but for a server.)
You can use launchd for that purpose. Here is an example of a launchd config plist that will execute an AppleScript when a disk is mounted:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
    &lt;dict&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;Example&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
            &lt;string&gt;/Users/sakra/Documents/Test.applescript&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;StartOnMount&lt;/key&gt;
        &lt;true/&gt;
    &lt;/dict&gt;
&lt;/plist&gt;


To activate the config plist save it to the LaunchAgents folder in your Library folder as Example.plist.

From the Terminal you can then use the command launchctl to activate Example.plist by running:

launchctl load ~/Library/LaunchAgents/Example.plist


The AppleScript will then be run each time a filesystem is mounted.

To deactivate it, run:

launchctl unload ~/Library/LaunchAgents/Example.plist