• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mount volume without error dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mount volume without error dialog


  • Subject: Re: Mount volume without error dialog
  • From: Gnarlodious <email@hidden>
  • Date: Mon, 02 Feb 2004 14:47:33 -0700

Here's what I use with no prob at all:

global ServerFolder
global MountedDisk
property ServerPassword : ""

set ServerFolder to "afp://207.127.235.86/CogentR/"
set MountedDisk to "CogentR"
if ServerPassword = "" then
tell me to display dialog MountedDisk & " password ?" default answer ,
"" buttons {"Cancel", "OK"} default button 2 with icon 1 giving up
after 60
set ServerPassword to the text returned of the result
end if

on idle
tell application "Finder"
if disk MountedDisk exists then --do nothing
else
with timeout of 60 seconds
mount volume ServerFolder as user name MountedDisk with
password ServerPassword
end timeout
end if
end tell
return 540 -- number of seconds before "on idle" is called
end idle


This script keeps ServerX mounted even though it wants to disconnect after
10 minutes of inactivity.

--Gnarlie



Entity email@hidden spoke thus:

> Hi Gary,
>
> Thanks for your reply. I tried your suggestion as so:
>
> -------
> try
> mount volume "afp://" & userName & ":" & passWord & "@"
> & serverName & "/" & dirName
> on error number errNum
> if errNum is -128 then
> display dialog "Server Missing"
> end if
> end try
> -------
>
> But I still get the 'Connection Failed. An Appleshare
> system error occurred' error dialog before it gets to the
> 'on error' part of the code. I'm curious as to why this
> dialog still appears even though it's in a try statement.
>
> Thanks again for your help.
>
> Jay
>
> email@hidden wrote [2/2/04 3:24 PM]:
>
>> When I'm trying to hook up to a server (on OS 10.2.6) this
>> works fine:
>>
>> -------
>> try
>> mount volume "afp://" & userName & ":" & passWord & "@" &
>> serverName & "/" & dirName
>> on error
>> -- Error info
>> end try
>> -------
>>
>> but if the password has become disabled (which happens
> every
>> now and then) then I get an error dialog that says
>> 'Connection Failed. An Appleshare system error occurred'.
>> The script will not continue until I hit the 'ok' button
> on
>> this dialog.
>>
>> Is there any way to NOT get this dialog if there is an
> error
>> so I can continue with the 'try' block? I'd like to find
>> another way besides using System Events if possible.
>>
>> Thanks.
>>
>> Jay
>
> Hi Jay.
>
> What you want to do is determine the error number returned,
> then trap for
> that specific error (or others) in the try block.
>
> With these features, you can direct the flow of your script
> based on the
> error returned, giving you a finer control over the
> branching.
>
> try
> display dialog "Hello world"
> on error errMsg number errNum
> if errNum = -128 then display dialog "you clicked
> cancel"
> end try
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Mount volume without error dialog (From: email@hidden)

  • Prev by Date: Re: Mount volume without error dialog
  • Next by Date: Re: Illustrator has placed images that need to be embedded
  • Previous by thread: Re: Mount volume without error dialog
  • Next by thread: Re: Mount volume without error dialog
  • Index(es):
    • Date
    • Thread