Check if the checkbox is checked (in chrome) Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
zhu25
Posts: 9
Joined: 01 Feb 2021, 13:52

Check if the checkbox is checked (in chrome)

24 Feb 2021, 14:45

Hi

I`m writing a code and I`m stuck with this step>
almost at the end of the code I need AHK to find out if a checkbox is checked on the window. If it is checked, then just need it to proceed with the rest of the code. If it is not checked - I need AHK to check it and then proceed with the rest of the code.

• Is there a way for AHK to find out if one of the checkboxes (or both) is/are checked when it (the checkbox) appears on a window (in a program, that runs on Chrome)?

for example, I run a command and AHK eventually gets to see a window where 2 checkboxes are lined up vertically in a single column:

[v] - this is the checkbox that I need to be checked(if not already checked). When it is checked, the one below becomes checked automatically and that`s good.
[v]

Been looking about checkboxes, but I could only find posts, that are about GUI related checkboxes, which is not related to this case(?), and other topics have something to do with javascript. Is it possible with just AHK? Does anyone know how/ has had experience with it? :idea:

If yes, should I first get the X, Y coordinates of the checkbox? Lets say I do, then what? :?: :eh:
User avatar
rommmcek
Posts: 1324
Joined: 15 Aug 2014, 15:18

Re: Check if the checkbox is checked (in chrome)  Topic is solved

24 Feb 2021, 18:33

If you don't want java, Acc is alternative. Here is en example how to check Ahk Login check-boxes:

Code: Select all

#Include Acc.ahk ; https://github.com/sancarn/ACC.AHK
;code assumes chrmoe has opend: https://www.autohotkey.com/boards/ucp.php?mode=login
WinActivate ahk_exe chrome.exe
WinWaitActive ahk_exe chrome.exe
hWnd:= WinExist("ahk_exe chrome.exe")
        Acc := Acc_Get("Object", "4.1.2.2.2.1.3.2.2.1.2.3.1.1", 0, "ahk_id " hwnd) ; \/ (check Remember...)
        if (acc.accDefaultAction(0) = "check")
            Acc.accDoDefaultAction(0)
        Acc := Acc_Get("Object", "4.1.2.2.2.1.3.2.2.1.2.3.2.1", 0, "ahk_id " hwnd) ; \/ (check Hide...)
        if (acc.accDefaultAction(0) = "check")
            Acc.accDoDefaultAction(0)
        Acc:= ""
 ExitApp
P.s.: To get the acc Path (4.1.2.2...) you need Acc Viewer RP3.5.ahk
Last edited by rommmcek on 10 Apr 2021, 09:26, edited 1 time in total.
zhu25
Posts: 9
Joined: 01 Feb 2021, 13:52

Re: Check if the checkbox is checked (in chrome)

25 Feb 2021, 10:17

thanks, will look into it!

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, donsonmd and 51 guests