tags:

views:

29

answers:

1

Hello, guys.

The start up script bellow mounts a network drive in my macbook:

try
  tell application "Finder"
     mount volume "afp://iMac-01._afpovertcp._tcp.local/Backup%20HD"
  end tell
end try

There is two problems with this script for me:

  • If I am out of the local network that the network drive is located, the script takes a long time trying to connect with it, and makes my macbook slowly in initialization. So, how to setup a maximum time for the script try to connect with the network drive?

  • If the network drive cannot be connected, a message warning me of that pops out. How to ignore this message? i.e, make it not appears.

I'm never made an apple script before of that, so please, if it is possible, help me modifying the original script.

Thanks in advance.

+1  A: 

use 'with timout'

try
    with timeout of x seconds
        tell application "Finder"
            mount volume "afp://iMac-01._afpovertcp._tcp.local/Backup%20HD"
        end tell
    end timeout
end try
mcgrailm
Will try. Thanks for your answer!
R31n4ld0_
The script ignores the timeout and take about 2 minutes to send a warning. Same thing that before. :(
R31n4ld0_
you accepted my answer so did that work for you then or did you have to modify my code ?
mcgrailm