Couple Of Issues.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Brady53
Posts: 3
Joined: 15 Jun 2017, 09:41

Couple Of Issues.

22 Aug 2017, 08:52

Hello,

I have a script that I am doing the following with. Opening a program, selecting a window in that program and entering the password to that specific window. Below is a copy of my code.

I have a couple of issues highlighted below that I could use some help with.

1) I am having an issue whereby sometimes the password will be entered multiple times, this does not happen frequently and is a bit of an annoyance when it does happen. This is only a portion of the code and it will be opening multiple windows like the first one. Does anybody know why this is happening?

2) As you can see I am currently using automated mouse clicks and keyboard inputs to do the task. Is there anyway that I could run all of this in the background and maybe without the mouse and keyboard presses?

/* Open VNC Viewer, change title to capitals and maximize the window
*/
Run, C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe
WinWait, VNC Viewer
WinSetTitle, VNCVIEWER
WinMaximize, VNCVIEWER

WinWait, VNCVIEWER

/* Open first window in VNC. Sends password to Authentication box and OK password
*/
MouseClick , Left, 827, 384 , 2
WinWait, Authentication
sleep, 500
Send, p
Send, a
Send, s
Send, s
Send, w
Send, o
Send, r
Send, d
sleep, 500
SendInput {Enter}
sleep, 500

Thanks in advance,

Jack
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Couple Of Issues.

22 Aug 2017, 14:16

1) Is this in a loop or on a timer (settimer)? Have you used a return to signal the end of a process or might it run into another part of your script that uses Send, Password?

2) You can look into learning ControlClick and ControlSend so they do not capture your mouse, but it can lead to a problem when your physical input blends with this "Control" Input, such as if you are pressing Shift when it tries to type password, you may get paSWOrd.
Brady53
Posts: 3
Joined: 15 Jun 2017, 09:41

Re: Couple Of Issues.

23 Aug 2017, 02:55

Exaskryz wrote:1) Is this in a loop or on a timer (settimer)? Have you used a return to signal the end of a process or might it run into another part of your script that uses Send, Password?

No loop or timer, I just start the script and it runs through. When I say there is multiple instances of the same script, I also change what window I want to open up using the keyboard input controls, and then is just a copy of the above script. Have not used a return, will look into that.

2) You can look into learning ControlClick and ControlSend so they do not capture your mouse, but it can lead to a problem when your physical input blends with this "Control" Input, such as if you are pressing Shift when it tries to type password, you may get paSWOrd.
Thanks, will have a go at using this as there will be no physical interaction with mouse or keyboard as the script will be running in the boot directory of the system I am using with no mouse or keyboard attached.

After posting this yesterday I tried adding a delay inbetween each character of password in put, eg

Ssleep, 500
Send, p
sleep, 500
Send, a
sleep, 500
Send, s

etc

This did not help but allowed me to see what sometimes it enters 2 characters instead of one, ie. ppaasswwoorrdd.

Thanks for your reply and any further help is appreciated

Jack
Danielsan73
Posts: 18
Joined: 07 Nov 2014, 10:20

Re: Couple Of Issues.

23 Aug 2017, 04:03

try this:

Code: Select all

MouseClick , Left, 827, 384 , 2
WinWait, Authentication,,3 ;Time out 3 sec.
IfWinNotActive, Authentication
WinWaitActive, Authentication,,5 ;Time out 5 sec.
if ErrorLevel
{
    MsgBox, ,,Window Authentication not found! ,1
    return
}
sleep, 200
Send, password{Enter}
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Couple Of Issues.

23 Aug 2017, 11:01

Consider looking at SetKeyDelay. I mean, maybe for some reason the default pressing speed is too slow. Hard for me to imagine a scenario where it is, but consider making it as fast as possible. I'd wonder if the key releases are ever counted as the second press for whatever reason by your program. But if it's only sometimes, I can't imagine why. Unless two scripts are being run accidentally while you are editing the script. Consider #SingleInstance, Force in your script.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 243 guests