GUI Help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mahatmahardy
Posts: 1
Joined: 05 Oct 2022, 12:35

GUI Help

Post by mahatmahardy » 05 Oct 2022, 12:42

Hi all,

I am seeking assistance with this GUI. I basically have a button that launches a certain website. When the website loads, I want it to input the websites credentials. Please see my script below and I appreciate all of the assistance! thank you! and cheers!

Code: Select all

Bluepeak: - this is attached to a button that launches the website when clicked. 
Run, www.website.com 
WinWait New-Entry
WinActivate
Sleep, 400
Send, {Text}username{Tab}
Sleep, 400
Send, {Text password{ENTER}
Return
[Mod edit: [code][/code] tags added.]

garry
Posts: 3758
Joined: 22 Dec 2013, 12:50

Re: GUI Help

Post by garry » 05 Oct 2022, 15:35

example for chrome browser , can save the login passwords
chrome://settings/passwords
here an example , maybe difficult to say when url is ready , here click with mouse leftbutton in first-field for login ( username ) when url loaded / ready
EDIT: an user mentioned before , bracket missing in your script ( after Text ) > Send, {Text}password{ENTER}

Code: Select all

!h::      ;- for test alt+h  or your button gLabel
#warn
setworkingdir,%a_scriptdir%
Settitlematchmode,2
;--
ixex1:=""
ixex1:="C:\Program Files\Google\Chrome\Application\chrome.exe "  ;- start chrome browser if wanted otherwise default-browser
AA:="myusername"         ;-- Username
BB:="mypassword"         ;-- Password 
cc:="https://www.myurl"  ;- URL
dd:="Textxx"             ;--  word must exist in title / part from title
Run,%ixex1%%cc%,,max
WinWait,%dd%
IfWinNotActive ,%dd%,,WinActivate,%dd%
  WinWaitActive,%dd%
;return
;-------------
;- when url is ready , continue to click in first field  ( username ) with mouse leftclick
KeyWait, LButton, D
sleep,500
clipboard:=aa
send,^v{TAB}
sleep,500
clipboard:=bb
send,^v{TAB}{TAB}   ;- maybe 2 tabs
send,{ENTER}
clipboard=
ExitApp
;-------------
esc::exitapp
==============
Last edited by garry on 05 Oct 2022, 15:37, edited 1 time in total.

kintar0e
Posts: 41
Joined: 05 Mar 2019, 07:32

Re: GUI Help

Post by kintar0e » 05 Oct 2022, 19:02

Exmaple using UIAutomation with a focus on Chrome library. viewtopic.php?f=6&t=104999

Code: Select all

#Include, UIA_Interface.ahk
SetTitleMatchMode, 2

	Run, www.autohotkey.com/boards/ucp.php?mode=login
	Sleep 1000
	if WinExist("AutoHotkey Community - User Control Panel - Login"){
		WinActivate

		UIA := UIA_Interface()
		U_IDChrome := WinExist("A")
		ChromeUIA := UIA.ElementFromHandle(U_IDChrome)

		if (user := ChromeUIA.WaitElementExist("AutomationId=username",,,,1000))
		{
			user.SetValue("MyUserName")
			ChromeUIA.WaitElementExist("AutomationId=password").SetValue("MyPassword")
			Sleep 1000
			; ChromeUIA.WaitElementExist("Name=Login AND ControlType=Button").Click()
			ChromeUIA.WaitElementExist("Name=Login AND ControlType=Button").Highlight()
		}

		UIA :=  ""
	}

garry
Posts: 3758
Joined: 22 Dec 2013, 12:50

Re: GUI Help

Post by garry » 06 Oct 2022, 04:18

@kintar0e thank you , works fine

Code: Select all

;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=104999       ;- < UIA_Interface.ahk / UIAutomation with a focus on Chrome : Descolada 20220606

;#Include, UIA_Interface.ahk ;- in a_scriptdir
#Include, <UIA_Interface>    ;- in "C:\Program Files\AutoHotkey\LIB"
;-- change this : ---
aa:="myusername"
bb:="mypassword"
;--------------------
SetTitleMatchMode, 2
	Run, www.autohotkey.com/boards/ucp.php?mode=login
	Sleep 1000
	if WinExist("AutoHotkey Community - User Control Panel - Login"){
		WinActivate
		UIA := UIA_Interface()
		U_IDChrome := WinExist("A")
		ChromeUIA := UIA.ElementFromHandle(U_IDChrome)
		if (user := ChromeUIA.WaitElementExist("AutomationId=username",,,,1000))
		{
			user.SetValue(AA)
			ChromeUIA.WaitElementExist("AutomationId=password").SetValue(BB)
			Sleep 1000
			ChromeUIA.WaitElementExist("Name=Login AND ControlType=Button").Click()
			;ChromeUIA.WaitElementExist("Name=Login AND ControlType=Button").Highlight()
		}
		UIA :=  ""
	}
exitapp


Post Reply

Return to “Ask for Help (v1)”