Send keystrokes to login site

Get help with using AutoHotkey and its commands and hotkeys
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

01 Aug 2020, 10:30

Boiler, I tried your last script as administrator, and the window does not minimize. So it appears that the execution doesn't reach that point, or there's some other reason it doesn't minimize.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

01 Aug 2020, 10:38

Did you re-check the window title? It needs to be the title as the URL is loaded -- before you do anything like login to it.
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

01 Aug 2020, 10:43

URL: https us.etrade.com /home/welcome-back Broken Link for safety
Window Spy title: Investing, Trading and Retirement - E*TRADE Financial - Google Chrome
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

01 Aug 2020, 10:50

That URL is different, so I guess you’re saying when you run the login URL it forwards you to the welcome back URL?

When you just run that URL and do nothing else, is the cursor where you expect it to be? Is it flashing in the correct field without you having to click anywhere?
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

01 Aug 2020, 11:23

Yes, when I execute my script, that's when I get the 'welcome back' URL. And the password field has a blinking cursor as usual.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

01 Aug 2020, 13:34

I’m running out of ideas. Let’s try this. Make sure all instances of Chrome are closed, the run this script:

Code: Select all

 !e::
	Run, https://us.etrade.com/e/t/user/login
	WinWait, ahk_exe chrome.exe
	MsgBox, Click OK to activate the window
	WinActivate,  ahk_exe chrome.exe
	Sleep, 1000
	Send, {down}{down}{enter}{enter}
return
Let me know if it shows the message box and then what happens. If it doesn’t work, try running it as administrator (and describe what you did to run it as administrator).
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 04:53

I ran your script as administrator by right-clicking the script file and selecting, 'run as administrator', but I did not get the message box.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 06:16

Did you press the hotkey? Run it without the hotkey. Just use this script and nothing else inside it, both normal and as admin:

Code: Select all

Run, https://us.etrade.com/e/t/user/login
WinWait, ahk_exe chrome.exe
MsgBox, Click OK to activate the window
WinActivate,  ahk_exe chrome.exe
Sleep, 1000
Send, {down}{down}{enter}{enter}
return
If you're using Google Chrome as your default browser, how can it not show the message box?
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 07:19

I ran it with the hotkey Alt m. Before our forum session began I ran it without the hotkey as well. The result was always the same i.e. Google would open, the eTrade app would display with a blinking cursor in the password field.

I don't know why I don't get the message; it's as if the MsgBox statement was not executed.
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 07:33

Correction: hotkey Alt e not Alt m
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 09:49

twhanson1 wrote:
02 Aug 2020, 07:19
I don't know why I don't get the message; it's as if the MsgBox statement was not executed.
Are you sure the MsgBox isn’t behind the browser or something? Double-click on the script’s tray icon to see what lines have been executed.
garry
Posts: 2338
Joined: 22 Dec 2013, 12:50

Re: Send keystrokes to login site

02 Aug 2020, 10:25

@boiler
Are you sure the MsgBox isn’t behind the browser or something?
make the msgbox alwaysontop :

Code: Select all

settitlematchmode,2
Run, https://us.etrade.com/e/t/user/login
WinWait, ahk_exe chrome.exe
msgbox, 262208,TEST ,Click OK to activate the window
WinActivate,  ahk_exe chrome.exe
return
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 10:31

The only windows open were Google (ETrade app), notepad, and my Desktop. One by one I minimized each, and there was no hidden MsgBox.

Here's what I got when I double-clicked the AutoHotKey script icon:

Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.

---- C:\Users\new\Desktop\HotKeys and Hotstrings.ahk
001: Return (20381.59)

Press [F5] to refresh.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 12:34

Did you add these lines to a larger script that contains hotkeys and hotstrings? And did you put those lines below the hotkeys and hotstrings? They will never run if you do that. Please make a script with nothing else in it but these lines and run that:

Code: Select all

settitlematchmode,2
Run, https://us.etrade.com/e/t/user/login
WinWait, ahk_exe chrome.exe
msgbox, 262208,TEST ,Click OK to activate the window
WinActivate,  ahk_exe chrome.exe
return
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 15:20

I ran your latest script with nothing else included. This time, eTrade opened in a reduced window and I did get the message. after I hit OK I got the blinking cursor in the password field.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 15:25

Okay, so add the send stuff at the bottom of the same script. You can remove the MsgBox line. Always run it as its own script. It can be combined with other hotkeys later after you get it working and know how to properly combine the code.
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 15:32

After this partial success, I removed the message and added

Code: Select all

send, {down}{down}{enter}{enter}
before the Return statement.

I still only get the blinking cursor. btw

Code: Select all

send, {down}{down}{enter}{enter}
still works if I do it manually.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 16:48

How about if you replace those keys with 123456? Does that get entered into the field?
twhanson1
Posts: 25
Joined: 11 Nov 2016, 14:19
Google: Thaddeous Wayne Hanson
GitHub: Thaddeous

Re: Send keystrokes to login site

02 Aug 2020, 17:36

OK, it gets interesting! When I tried 123456, nothing different happened, Then I decided to restore your MsgBox, and ran it again. This time I got 6 characters in the password field, presumably "123456". I thought I might have made a mistake so I ran the scripts again, both with and without the MsgBox. The tests were repeatable, i.e. the password is entered when the MsgBox is present, but not without it.
User avatar
boiler
Posts: 5605
Joined: 21 Dec 2014, 02:44

Re: Send keystrokes to login site

02 Aug 2020, 18:18

That makes it seem like the delay of having the MsgBox is helping. Try putting in a very long Sleep instead of the MsgBox. Like Sleep, 8000 or something. Maybe the page is slow to fully load and be ready to accept key strokes.

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, jeongrak2 and 45 guests