Username and Password verification

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.

I don’t understand what you’re asking. Please rephrase the problem.

PS: “schools” should be: “school’s”
Let’s set a good example for the students. :wink:

You’re right, thanks for pointing out the grammatical error!

Anyways the question I’m asking is if there’s a way AppleScript can identify that the share point window exists (before choosing a share and fully mounting the server)?

I’ll reword the original question.

Thanks for replying.

You can test if it’s already mounted. I think there’s a better way, but this will work:

tell application "Finder"
	set x to do shell script "ls /volumes"
	if x contains "nameofvolume" then
		display dialog "Yes, it exists."
	end if
end tell

I was thinking about running that shell command, but unfortunately I have over 60 separate share points and it would be troublesome to identify it in that manner. Plus I’m looking for a command or line(s) of code to identify the share point selection window, not the result of choosing a share.