Control, Check,, ButtonX, ; problem Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TXShooter
Posts: 165
Joined: 13 Dec 2017, 09:27

Control, Check,, ButtonX, ; problem

20 Sep 2018, 17:18

It took me a while to find this problem, and I'm pretty much at a loss on how to resolve it. I'm currently using Control, Check, , Button1, which works fine... on ONE computer. I found out the hard way that the number changes from computer to computer, for reasons that I can not figure out.

Is there any way to check this checkbox reliably (on any given computer) without using the ClassNN Control name, but perhaps by using the text of the checkbox?
TXShooter
Posts: 165
Joined: 13 Dec 2017, 09:27

Re: Control, Check,, ButtonX, ; problem

20 Sep 2018, 18:08

Never mind... using ControlGetText with the text of the control seems to have worked. Thanks anyway. :)
TXShooter
Posts: 165
Joined: 13 Dec 2017, 09:27

Re: Control, Check,, ButtonX, ; problem

02 Oct 2018, 21:25

I'm needing to come back to this thread because there's still something not right with Button (checkbox) selection between these two computers.

If I use ControlGetText on the Windows 10 machine to identify the control's ID, all works like it should. But, on my Windows 7 machine... well, I am having issues. I have had to set a delay for up to 11 seconds (it seems random) in order for ControlGetText to return anything, and failing to do so messes up everything subsequent to this value.

Code: Select all

	SetProjectSaveAs(FullFilePath)
		{
			SetTitleMatchMode, 2
			PostMsg(40022)		; This code correlates with File:Save As : 40022
			WinWait, Save Project,,60
			Sleep, 5000 ; <-- Should this be necessary (for as high as 11 seconds (11,000) in some test runs)?
			ControlGetText, tButton, Create ; Enable the 'Create Sub-directory for Project' setting
			;;MsgBox % "ControlGetText for Create subdirectory checkbox: " tButton
			Control, Check, , %tButton% ; Enable Create subdirectory for project
			return
		}
I have even had to implement a 'decision tree' before calling 'SetProjectSaveAs'.

Code: Select all

	If (A_Username = "Shooter") {
		global tButton := "Button1"
		} Else if (A_Username = "TXShooter") {
		global tButton := "Button2"
		} Else {
		MsgBox The current user isn't the owner of this script. Access is denied. Just kidding... but yeah, things be broken y'all. Call the dude that wrote this script.
		ExitApp
		}
So, I guess that I'm asking... should it have to have a delay in the script to be accurate? Side-stepping the delay, do I really need a 'decision tree' to preset the value of the button that needs to be clicked (which makes this less portable than I would prefer)? Or is there something that I am missing about ControlGetText that would prevent it from getting the control's identification right every time on every computer?
TXShooter
Posts: 165
Joined: 13 Dec 2017, 09:27

Re: Control, Check,, ButtonX, ; problem  Topic is solved

06 Oct 2018, 11:05

I guess that I will just have to add a 20 second delay. Thanks for all the help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, CrowexBR, Google [Bot], mcd, rubeusmalfoy, ShatterCoder, spellegrnio1 and 82 guests