Hi,
I’ve written a script where a user enters their credentials and mounts a server. The problem is there’s a slight glitch after entering the proper credentials. This occurs on the OS’s share point selection window while my program hangs in the background. Everything works great if the user simply chooses a share and clicks “OK”; otherwise if the user selects “Cancel” my application flags this as an error. Granted this is all placed within a try block to flag an error when the user enters the wrong username or password, but is it possible for AppleScript to identify the exists of the share point selection window BEFORE mounting the server?
Snippet of remainder code:
-- first half of the script not posted since it's irrelevant to the error
tell application "Finder"
try
mount volume "afp://" & currentUser & ":" & currentPass & "@172.x.x.x"
on error
beep
tell application "Play Sound 2" to stop
tell application "Play Sound 2" to quit
set frontmost to true
set E to (display dialog "YOUR CREDENTIALS ARE INCORRECT!
It's also possible you're not connected
to the internet or the schools LAN.
Make sure your wireless icon is on
and you're attached to the network." buttons {"Exit", "Repeat"} default button 2 with title " ~~ERROR~~" with icon 0 giving up after 20)
if button returned of E is "Exit" then
tell me to quit
error number -128
else
if startup disk exists then
tell application "Play Sound 2" to stop
tell application "Play Sound 2" to quit
set frontmost to false
exit repeat
tell me to quit
error number -128
end if
end if
end try
tell application "Play Sound 2" to stop
tell application "Play Sound 2" to quit
tell me to quit
error number -128
end tell
end repeat
end if
end if
end if
end if
end repeat
Thank you for any support in this matter.