I want to mount a network volume, and I want a dialog box to display, “Mounting Shared Drive”. I don’t want to use
display dialog
becuase the user will have to click a button. Is there anyway to have a notification dialog box diaply while the action is being performed, and then go away upon successful completion? Also, can I have another message come up if the action fails? My code so far is below. Thank you!
with timeout of 10 seconds
--display something like "Mounting volume"
try
mount volume "smb://guest:nopass@some.share"
--if there is an error display something like "unable to mount network volume"
end try
end timeout
with timeout of 10 seconds
--display something like "Mounting volume"
try
mount volume "smb://guest:nopass@some.share"
on error
--if there is an error display something like "unable to mount network volume"
display alert "Failed to Mount" as warning giving up after 1
end try
end timeout
with network shares i normaly do something like this
set pingResult to do shell script "ping -c 1 192.168.0.2"
if pingResult contains " 0% Packet" then
--do the script here.
end if
Thank you for the reply. Is the first part possible (displaying a message “Mounting Share” without the user having to click a button to dismiss the message)?
Thanks again.
the “with timeout of 10 seconds” bit will dismiss the dialog without any user interaction. The user can dismiss it before then, but doesn’t have to.