ControlClick not working?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
helloguys
Posts: 5
Joined: 13 May 2018, 09:32

ControlClick not working?

13 May 2018, 09:58

Sorry for newbie questions. I'm running AHK v1.1.28.02.

1) When using WinWait, WinExist and ControlClick commands, I assume they follow the same rules to match WinTitle and WinText?
2) What's the difference of putting quotation marks around the text and no quotation marks? e.g. "Untitled - Notepad" vs. Untitled - Notepad ?
3) I have a script that WinExist matches but ControlClick didn't seem to take effect. It seems like the WinTitle and WinText in the ControlClick didn't match.

My script:

Code: Select all

SetControlDelay -1
SetTitleMatchMode, 1

Loop {

WinWait, Cisco AnyConnect

If WinExist("Cisco AnyConnect", "Max time exceeded")
{
	ControlClick, OK, "Cisco AnyConnect", "Max time exceeded",,, NA
	run "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"
}
Else If WinExist("Cisco AnyConnect Secure Mobility Client", "Ready to connect")
{
	ControlClick, Connect, "Cisco AnyConnect Secure Mobility Client", "Ready to connect",,, NA
}

WinWait, "Cisco AnyConnect", "PIN:"
ControlSetText, Edit2, 123456
ControlClick, OK, Cisco AnyConnect, PIN:,,, NA
}
Return


AHK debug output:
---- D:\Users\User\Desktop\VPN.ahk

Code: Select all

001: SetControlDelay,-1
002: SetTitleMatchMode,1
004: Loop
006: WinWait,Cisco AnyConnect (1.67)
008: if WinExist("Cisco AnyConnect", "Max time exceeded")  
014: if WinExist("Cisco AnyConnect Secure Mobility Client", "Ready to connect")  
016: ControlClick,Connect,"Cisco AnyConnect Secure Mobility Client","Ready to connect",,,NA
017: }
019: WinWait,"Cisco AnyConnect","PIN:" (2.00)
If I remove the WinTitle and WinText parameters from ControlClick (i.e. "ControlClick, Connect,,,,, NA"), it works.

Why is that?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, doodles333, vysmaty and 247 guests