gal9 Posted October 25, 2022 Share Posted October 25, 2022 (edited) I hope I'm not spamming. I'm trying to check if a radio button is checked If $setting = "enabled" Then If ControlCommand($mtric, "Not &Configured", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad13]", "Check", "") = 1 Then Send("{down 1}{ENTER}") Sleep(2000) ElseIf ControlCommand($mtric, "&Enabled", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad14]", "Check", "") = 1 Then Sleep(2000) ElseIf ControlCommand($mtric, "&Disabled", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad15]", "Check", "") = 1 Then Send("{up 1}{ENTER}") Sleep(2000) EndIf EndIf If $setting = "disable" Then If ControlCommand($mtric, "Not &Configured", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad13]", "Check", "") = 1 Then Send("{down 2}{ENTER}") ElseIf ControlCommand($mtric, "&Enabled", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad14]","Check", "") = 1 Then Send("{down 1}{ENTER}") ElseIf ControlCommand($mtric, "&Disabled", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad15]", "Check", "") = 1 Then Send("{ENTER}") Sleep(2000) EndIf EndIf it not work. i see this exmple https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateRadio.htm but I do not want to create radio buttons I want to read Edited October 25, 2022 by gal9 Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 use the same ControlCommand with the switch "IsChecked", "" Link to comment Share on other sites More sharing options...
gal9 Posted October 25, 2022 Author Share Posted October 25, 2022 1 minute ago, BigDaddyO said: use the same ControlCommand with the switch "IsChecked", "" IsChecked work of checkbox not radio buttons Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 Did you try it? What did it return? Otherwise, I think you can use the GuiCtrl commands if you pass the control handle to them. #include <GUIConstantsEx.au3> $hRdo1 = ControlGetHandle($mtric, "Not &Configured", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad13]",) If BitAND(GUICtrlRead($hRdo1), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox(0, "", "It's Checked") Else MsgBox(0, "", "It's NOT checked") EndIf Link to comment Share on other sites More sharing options...
gal9 Posted October 26, 2022 Author Share Posted October 26, 2022 (edited) On 10/25/2022 at 5:39 PM, BigDaddyO said: Did you try it? What did it return? Otherwise, I think you can use the GuiCtrl commands if you pass the control handle to them. #include <GUIConstantsEx.au3> $hRdo1 = ControlGetHandle($mtric, "Not &Configured", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad13]",) If BitAND(GUICtrlRead($hRdo1), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox(0, "", "It's Checked") Else MsgBox(0, "", "It's NOT checked") EndIf it is work thanks!!! editing: no is not Edited October 28, 2022 by gal9 Link to comment Share on other sites More sharing options...
gal9 Posted October 26, 2022 Author Share Posted October 26, 2022 (edited) 18 hours ago, BigDaddyO said: Did you try it? What did it return? Otherwise, I think you can use the GuiCtrl commands if you pass the control handle to them. #include <GUIConstantsEx.au3> $hRdo1 = ControlGetHandle($mtric, "Not &Configured", "[WindowsForms10.BUTTON.app.0.297b065_r64_ad13]",) If BitAND(GUICtrlRead($hRdo1), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox(0, "", "It's Checked") Else MsgBox(0, "", "It's NOT checked") EndIf expandcollapse popup$notConfigured = ControlGetHandle($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13") $enabled = ControlGetHandle($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14") $disabled = ControlGetHandle($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15") If $setting = "enabled" Then Sleep(3500) WinWaitActive("[WindowsForms10.Window.8.app.0.297b065_r69_ad16]") If BitAND(GUICtrlRead($notConfigured), $GUI_CHECKED) = $GUI_CHECKED Then Send("{down 1}{ENTER}") ElseIf BitAND(GUICtrlRead($disabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{up 1}{ENTER}") ElseIf BitAND(GUICtrlRead($enabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{ENTER}") EndIf EndIf If $setting = "disable" Then Sleep(3500) WinWaitActive("[WindowsForms10.Window.8.app.0.297b065_r69_ad16]") If BitAND(GUICtrlRead($notConfigured), $GUI_CHECKED) = $GUI_CHECKED Then Send("{down 2}{ENTER}") ElseIf BitAND(GUICtrlRead($disabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{ENTER}") ElseIf BitAND(GUICtrlRead($enabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{down 1}{ENTER}") EndIf EndIf If $setting = "$not configured" Then Sleep(3500) If BitAND(GUICtrlRead($notConfigured), $GUI_CHECKED) = $GUI_CHECKED Then Send("{ENTER}") ElseIf BitAND(GUICtrlRead($disabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{up 1}{ENTER}") ElseIf BitAND(GUICtrlRead($enabled), $GUI_CHECKED) = $GUI_CHECKED Then Send("{down 1}{ENTER}") EndIf EndIf i try to do this but is stuck not work Edited October 26, 2022 by gal9 Link to comment Share on other sites More sharing options...
Nine Posted October 26, 2022 Share Posted October 26, 2022 Please refer to _GUICtrlButton_GetCheck in help file. Note that it requires a handle not a GUI ID. This is just what you need. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
gal9 Posted October 26, 2022 Author Share Posted October 26, 2022 1 minute ago, Nine said: Please refer to _GUICtrlButton_GetCheck in help file. Note that it requires a handle not a GUI ID. This is just what you need. you mean coordinate? Link to comment Share on other sites More sharing options...
Nine Posted October 26, 2022 Share Posted October 26, 2022 From help file Quote Gets the check state of a radio button or check box “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
gal9 Posted October 26, 2022 Author Share Posted October 26, 2022 (edited) 5 minutes ago, Nine said: From help file But there crate radio I want to scan WindowsForms how i can't to catch buttons. if you have example scan from Edited October 26, 2022 by gal9 Link to comment Share on other sites More sharing options...
Nine Posted October 26, 2022 Share Posted October 26, 2022 I don't understand what you are saying. Just use the function with the handle of your radio button, not that complicated, is it ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
gal9 Posted October 26, 2022 Author Share Posted October 26, 2022 3 minutes ago, Nine said: I don't understand what you are saying. Just use the function with the handle of your radio button, not that complicated, is it ? I am using the "Autoit v3 Windows Info", and I found the "Class" and the "Instances" of the radio button. Now I need to do 2 things: 1) I want to select the radio button by using the "class" and the "instances". 2) I need to validate the status of the same radio button. If the radio button is selected or not selected. Link to comment Share on other sites More sharing options...
gal9 Posted October 28, 2022 Author Share Posted October 28, 2022 someone can help please Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 28, 2022 Share Posted October 28, 2022 Nine did help you. you need to look in the help file at _GUICtrlButton_GetCheck it even has an example. if that function is not working for you, post the code you use as a test and show what the return from the function is. Link to comment Share on other sites More sharing options...
gal9 Posted October 30, 2022 Author Share Posted October 30, 2022 On 10/28/2022 at 3:03 PM, BigDaddyO said: Nine did help you. you need to look in the help file at _GUICtrlButton_GetCheck it even has an example. if that function is not working for you, post the code you use as a test and show what the return from the function is. But in the example they use coordinates I want to use class and instances Link to comment Share on other sites More sharing options...
gal9 Posted October 30, 2022 Author Share Posted October 30, 2022 (edited) On 10/28/2022 at 3:03 PM, BigDaddyO said: Nine did help you. you need to look in the help file at _GUICtrlButton_GetCheck it even has an example. if that function is not working for you, post the code you use as a test and show what the return from the function is. I get three times Button is cleared for not configured enabled disabled this is my code i try to do like example expandcollapse popup#include <Constants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: Jonathan Bennett (jon at autoitscript dot com) ; Modified: mLipok ; ; Script Function: ; Opens Notepad, types in some text and then quits the application. ; If Not $CmdLine[0] Then Exit Run(@AutoItExe & " " & @ScriptFullPath & " /Allow Adobe Flash /param2 disable") MsgBox(4096, "message", "The setting "& $CmdLine[1] & " set to " & $CmdLine[2] & " This box will time out in 3 seconds", 3) Sleep(5000) Local $mtric =$CmdLine[1] ; "Allow Adobe Flash" Local $setting = $CmdLine[2] ;"disable" _Example($mtric,$setting) MsgBox(4096, "Test", "The setting saved and set "& $mtric & " to " & $setting & " This box will time out in 3 seconds", 3) Exit(0) ; Finished! Func _Example($mtric,$setting) ; Run gpedit.msc ; Run("c:\Windows\system32\mmc.exe c:\Windows\system32\gpedit.msc /a") Run("c:\Windows\system32\mmc.exe C:\Users\gal.dahan\Desktop\script\gpedit_v1.msc /a") Sleep(2500) WinWaitActive("[CLASS:MMCMainFrame]") Sleep(500) Send("{ALT}{A}{O}") While ControlGetFocus("[TITLE:Filter Options]") = "" sleep(1) WEnd WinWaitActive("[TITLE:Filter Options]") Sleep(3500) If ControlCommand("Filter Options", "Enable &Keyword Filters", "Button2", "IsChecked", "") = 0 Then Send("{ALT down}{K}{F}{ALT up}") Else Send("{ALT down}{F}{ALT up}") EndIf Sleep(3500) ;;Type search Send($mtric) Sleep(3500) Send("{ENTER}") Sleep(5500) Send("{tab}{down 1}{ENTER}") Sleep(2000) Send("{down 2}{ENTER}") Sleep(4000) Local $notConfigured = ControlGetHandle($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13") Local $enabled = ControlGetHandle($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14") Local $disabled = ControlGetHandle($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15") Example2() Sleep(3500) Send ("{Ctrl}{S}") Send("^s") ;_Validation($mtric,$setting) Sleep(3500) WinWaitActive("[CLASS:MMCMainFrame]") Send("{ALT down}{F4}{ALT up}") Sleep(2000) ;MsgBox(4096, "Test", "The setting saved and set "& $mtric & " to " & $setting & " This box will time out in 10 seconds", 10) EndFunc Global $g_idMemo Func Example2() Local $idRdo, $idRdo2, $idChk Local $notConfigured = ControlGetHandle($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13") Local $enabled = ControlGetHandle($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14") Local $disabled = ControlGetHandle($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15") _GUICtrlButton_SetCheck($notConfigured) _GUICtrlButton_SetFocus($notConfigured) ; set focus, shows this doesn't affect _GUICtrlButton_GetCheck GUISetState(@SW_SHOW) MemoWrite("$idRdo checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($enabled)) & @CRLF) MemoWrite("$idRdo2 checked status: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($notConfigured)) & @CRLF) MemoWrite("$idChk checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($disabled)) & @CRLF) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) Local $g_idMemo GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func _ExplainCheckState($iState) Switch $iState Case $BST_CHECKED MsgBox(4096, "message", "Button is checked.", 3) Return "Button is checked." Case $BST_INDETERMINATE MsgBox(4096, "message", "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style).", 3) Return "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)." Case $BST_UNCHECKED MsgBox(4096, "message", "Button is cleared", 3) Return "Button is cleared" EndSwitch EndFunc ;==>_ExplainCheckState it works until the moment I call Example2() to check the radio buttons. I get three times "Button is cleared" I need to check If it is checked Edited October 30, 2022 by gal9 Link to comment Share on other sites More sharing options...
SeanGozlan Posted October 30, 2022 Share Posted October 30, 2022 I have also problem with the radio button. There is any good example how to click on a radio button, but without using cordinate. This is odd. because the autoit tool find the radio button instances and the class easly. If there is a way to take the cordinate of class ? and then I can use to click on it. Please help. gal9 1 Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2022 Share Posted October 30, 2022 (edited) You did not set any error handling, how do you know that any statement is working ? Now we gonna do a small test, you're gonna run your application manually, then set the radio button "Not configured" manually also. Then run the following script from Scite : #include <GuiButton.au3> Local $hWnd = WinWaitActive("[CLASS:MMCMainFrame]", "", 5) ConsoleWrite("WinWaitActive " & @error & "/" & $hWnd & @CRLF) Local $hControl = ControlGetHandle($hWnd, "", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13") ConsoleWrite("Not configured " & @error & "/" & $hControl & @CRLF) Local $iResult = _GUICtrlButton_GetCheck($hControl) If $iResult = $BST_CHECKED Then MsgBox($MB_SYSTEMMODAL, "", "Checked") If $iResult = $BST_INDETERMINATE Then MsgBox($MB_SYSTEMMODAL, "", "Inderterminate") If $iResult = $BST_UNCHECKED Then MsgBox($MB_SYSTEMMODAL, "", "Cleared") Report Scite console. Edited October 30, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
gal9 Posted October 30, 2022 Author Share Posted October 30, 2022 (edited) 8 minutes ago, Nine said: You did not set any error handling, how do you know that any statement is working ? Now we gonna do a small test, you're gonna run your application manually, then set the radio button "Not configured" manually also. Then run the following script from Scite : #include <GuiButton.au3> Local $hWnd = WinWaitActive("[CLASS:MMCMainFrame]", "", 5) ConsoleWrite("WinWaitActive " & @error & "/" & $hWnd & @CRLF) Local $hControl = ControlGetHandle($hWnd, "", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13") ConsoleWrite("Not configured " & @error & "/" & $hControl & @CRLF) Local $iResult = _GUICtrlButton_GetCheck($hControl) If $iResult = $BST_CHECKED Then MsgBox($MB_SYSTEMMODAL, "", "Checked") If $iResult = $BST_INDETERMINATE Then MsgBox($MB_SYSTEMMODAL, "", "Inderterminate") If $iResult = $BST_UNCHECKED Then MsgBox($MB_SYSTEMMODAL, "", "Cleared") Report Scite console. "Not configured" is marked I get Cleared. "Enabled" is marked I get Cleared. "Disabled" is marked I get Cleared. in the console i get: Edited October 30, 2022 by gal9 Link to comment Share on other sites More sharing options...
gal9 Posted October 30, 2022 Author Share Posted October 30, 2022 this is my info Maybe a problem there? I don't see any problem Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now