Applescript: mount SMB shares / WakeOnLAN

|G2|

Registered
i have searched the forums for this, and checked the Scripts repositories, so hopefully my first thread (and post!) isn't going to upset anyone.

my Mac Mini runs the following Applescript at boot in order to mount SMB shares from my NAS:
Code:
delay 5
mount volume "smb://192.168.1.101/Folder1"
mount volume "smb://192.168.1.101/Folder2"
mount volume "smb://192.168.1.101/Folder3"
however, the NAS isn't left on all the time and as it supports WakeOnLAN i'd like to enhance the script to do the following:

ping 192.168.1.101
--response: run 'mount' code and exit
--no response:
----create and send magic packet for WOL
----wait a set amount of time
----ping again:
------response = run 'mount' code and exit
------no response = wait and try again 2/3 times before failing with useful message

anyone know how to do this? or even if the WOL bit is possible in Applescript? or could it be done with other scripting, or perhaps with a call out to a command-line program like XWOL? if so, any advice there would also be welcomed.

and i'd like the script to run Plex once it has successfully mounted the shares. am i right in thinking the following would work?
Code:
tell application "Plex" activate
thanks in advance for any help.
 
Last edited:
Back
Top