can't get button click to work.....Applescript

I am trying to set a script that will simply log me onto a server. I have looked online and have seen many people doing this. Right now all my script does is try to connect to a server, and then the “Connect to Server” dialog box comes up asking for my username and password. I have them autosaved so all I really need to do is click connect. I looked online and saw many people doing that by telling the button name…in my case Connnect… to click. I am using Accessibility inspector and have the name of the window which is “Connect to Server” and the name of the button is “Connect”. How can i get the script to press the connect button automatically…my code is as below

tell application "Finder"
	mount volume "afp://......................"  ------server information left out
	tell window "Connect to Server"
	end tell
end tell

Hi and welcome. :slight_smile:

The easiest way is :

property un : "username"
property pw : "¢¢¢¢¢" 

mount volume "afp://" & un & ":" & pw & "@Servername.local/theVolume" 

a Finder tell block is not needed