AmicusLinguae Posted February 15, 2017 Share Posted February 15, 2017 Hello, I'm a newcommer to this forum. The following script does sometimes work and sometimes not. It should uncheck the check box of Button21 and check the check box of Button22. I tested this firstly in a separat testfile, where it worked correctly. Then I included the script in a greater au3.-script, where it didn't work. Then I tested the separate testfile and there it did not work. I found that the @error variable was 1. Could you pleas help me? tia Regards _WinWaitActivate("Artikel bearbeiten","Serien-/Chargennu&mm") If (ControlCommand("Artikel bearbeiten","","[CLASSNN:Button21]", "IsChecked") )Then ConsoleWrite(@error&@CRLF) ControlCommand("Artikel bearbeiten","","[CLASSNN:Button21]","Uncheck") EndIf ConsoleWrite(@error&@CRLF) Sleep(2000) ;#cs _WinWaitActivate("Artikel bearbeiten","Serien-/Chargennu&mm") ConsoleWrite(ControlCommand("Artikel bearbeiten","","[CLASSNN:Button22]", "IsChecked")) If Not ControlCommand("Artikel bearbeiten","","[CLASSNN:Button22]", "IsChecked") Then ControlCommand("Artikel bearbeiten","","[CLASSNN:Button22]", "Check") EndIf ConsoleWrite(@error&@CRLF) Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 15, 2017 Author Share Posted February 15, 2017 Hello, I tried to use the following scripts. The console output is the following: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Andreas\AutoIt\Work\Test_Checkbox_002.au3" Test1Test2Tool pree: 0 Tool past: 1 "C:\Andreas\AutoIt\Work\CheckboxTool.au3" (89) : ==> Subscript used on non-accessible variable.: $rgblBaseline = GetColorAsRGBL($rectControl[0]+$posX,$rectControl[1]+$posY) $rgblBaseline = GetColorAsRGBL($rectControl^ ERROR >Exit code: 1 Time: 0.5946 So ther must be an error when executing CheckboxTool.au3 lines: 77-79 ConsoleWrite("Tool pree: "&@error&@CRLF) $rectControl = ControlGetPos($strWindowTitle, $strWindowText, $strCheckboxId) ConsoleWrite("Tool past: "&@error&@CRLF) Using CheckboxTool.au3 also ran without @error equal to zero. But the result of the the CheckboxIsChecked($strWindowTitle, $strWindowText, $strCheckboxId) Function was always the same if the checkbox was checkt or not. But now there is the mentiones error caused by line 78. What can I do to check if the checkbox is checked? tia Regards Test_Checkbox_002.au3 Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 15, 2017 Author Share Posted February 15, 2017 Phrase: Using CheckboxTool.au3 also ran without @error equal to zero. Must be: Using CheckboxTool.au3 also ran without @error not equal to zero. Link to comment Share on other sites More sharing options...
Subz Posted February 15, 2017 Share Posted February 15, 2017 What is the name of the Window you are trying to read the checkboxes with? Is it a third party application, browser or something else? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2017 Moderators Share Posted February 15, 2017 AmicusLinguae, Stick to just the one thread please - I have deleted the others. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 15, 2017 Author Share Posted February 15, 2017 @Subz The name of the window is "Artikel bearbeiten" . It is a "lexware premium" software. What could I do to solve this problem? AL Link to comment Share on other sites More sharing options...
Subz Posted February 15, 2017 Share Posted February 15, 2017 Sorry don't know the software can you try this: $hWnd = WinWaitActive("Artikel bearbeiten","Serien-/Chargennu&mm") If ControlCommand($hWnd, "", "Button21", "IsChecked") Then ConsoleWrite(@error & @CRLF) ControlCommand($hWnd,"","Button21", "Uncheck") EndIf ConsoleWrite(@error&@CRLF) Sleep(2000) ;#cs WinWaitActive($hWnd ,"Serien-/Chargennu&mm") ConsoleWrite(ControlCommand($hWnd, "", "Button22", "IsChecked") & @CRLF) If Not ControlCommand($hWnd, "", "Button22", "IsChecked") Then ControlCommand($hWnd, "", "Button22", "Check") EndIf ConsoleWrite(@error&@CRLF) Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 15, 2017 Author Share Posted February 15, 2017 I tried this, what you sent me. But the command "WinWaitActive" doesnot activate the window "Artikel bearbeiten" also if click on the window and it in an endless loop. What could I do? Link to comment Share on other sites More sharing options...
Subz Posted February 15, 2017 Share Posted February 15, 2017 Replace WinWaitActive with _WinWaitActivate (I believe this is a custom function you have). I'm not sure what you mean by an endless loop as the function isn't in a loop. Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 Thank you Subz. I made it the following way: using: Au3Recorder_Functions.au3 #include <Au3Recorder_Functions.au3> ConsoleWrite(@error & @CRLF) $hWnd = _WinWaitActivate("Artikel bearbeiten","",10) If ControlCommand($hWnd, "", "Button21", "IsChecked") Then ConsoleWrite(@error & @CRLF) ControlCommand($hWnd,"","Button21", "Uncheck") EndIf ConsoleWrite(@error&@CRLF) ;Sleep(2000) ;#cs _WinWaitActivate($hWnd ,"Serien-/Chargennu&mm") ConsoleWrite(ControlCommand($hWnd, "", "Button22", "IsChecked") & @CRLF) If Not ControlCommand($hWnd, "", "Button22", "IsChecked") Then ControlCommand($hWnd, "", "Button22", "Check") EndIf ConsoleWrite(@error&@CRLF) Au3Recorder_Functions.au3 Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 In Au3Recorder_Functions.au3 I gave in Func _WinWaitActivate($title,$text,$timeout=0) a return value: Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) Return(WinWaitActive($title,$text,$timeout)) EndFunc Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 Sorry, too early in joy. After trying the above solution in the stand alone programm, I tryed it in my grater programm, there it did work two times correctly. After that it also did not work in the stand alone program any more. What can I do? Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 Thank you Subz. I made it the following way: using: Au3Recorder_Functions.au3 #include <Au3Recorder_Functions.au3> ConsoleWrite(@error & @CRLF) $hWnd = _WinWaitActivate("Artikel bearbeiten","",10) If ControlCommand($hWnd, "", "Button21", "IsChecked") Then ConsoleWrite(@error & @CRLF) ControlCommand($hWnd,"","Button21", "Uncheck") EndIf ConsoleWrite(@error&@CRLF) ;Sleep(2000) ;#cs _WinWaitActivate($hWnd ,"Serien-/Chargennu&mm") ConsoleWrite(ControlCommand($hWnd, "", "Button22", "IsChecked") & @CRLF) If Not ControlCommand($hWnd, "", "Button22", "IsChecked") Then ControlCommand($hWnd, "", "Button22", "Check") EndIf ConsoleWrite(@error&@CRLF) Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 I found out that the ClassnameNN and other Properties changed. Therefore I cannot check the correct checkbox. Does anybody know which Property does not change when a new window of "Artikel bearbeiten" is opened? tia AL Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 I found out that not every time I open the window "Artikel bearbeitet" the button number changes from 14 to 22 and vice versa (may be also some other values which I have not tested till now). So I cannot predict if it is changed or not. How can I predict the button number without AutoIt_Info.exe Link to comment Share on other sites More sharing options...
Subz Posted February 16, 2017 Share Posted February 16, 2017 Can you use the Au3Info tool to hover the Checkbox and send through a screenshot? Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 Using the Au3Info I found out, that the ClassnameNN is mostly "Button14" sometimes "Buttton22" I have a kind of wizard, which opens a window for a database. This wizard opens a new dataset out of a displayed list. If I advance in this list the ClassnameNN is "Button14", if I go back is sometimes "Button22". What could I do? ScreeShots_Au3Info.doc ScreeShots_Au3Info.pdf Link to comment Share on other sites More sharing options...
Subz Posted February 16, 2017 Share Posted February 16, 2017 So look for unique identifiers for example is the text of the button unique, then use ControlCommand($hWnd, "Text of Button Here", "", "IsChecked") or if one fails you could check the other instance for example: If Not ControlCommand($hWnd, "", "Button22", "IsChecked") Then ControlCommand($hWnd, "", "Button22", "Check") If @error = 1 Then If Not ControlCommand($hWnd, "", "Button14", "IsChecked") Then ControlCommand($hWnd, "", "Button14", "Check") Endif Endif EndIf Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 Thank you @Subz, I will try you first solution. Link to comment Share on other sites More sharing options...
AmicusLinguae Posted February 16, 2017 Author Share Posted February 16, 2017 I have two checkboxes first's text is "&Aktualisierung der Kalkulationsvorgaben übernehmen" and second's text is "&Gewinn bei Verkaufspreisänderung aktualisieren" and I use the following code $hWnd = _WinWaitActivate("Artikel bearbeiten","Serien-/Chargennu&mm") ;#cs If ControlCommand($hWnd, "&Aktualisierung der Kalkulationsvorgaben übernehmen", "", "IsChecked") Then ConsoleWrite(@error & @CRLF) ControlCommand($hWnd,"&Aktualisierung der Kalkulationsvorgaben übernehmen","", "Uncheck") EndIf ConsoleWrite(@error&@CRLF) 1. If both checkboxes are unchecked, they stay unchecked. 2. If both checkboxes are check, the first stays checked and the seconde becomes unchecked. I cannot understad this, even if the second button's text is not mentioned in the script the second button is affected. 3. If the first button is checked and the second button ist unchecked, both checkboxes stay in their condition. 4. If the first button is unchecked and the second button is checked, both checkboxes stay in their condition. What could I do to receive that the first button is not checked and the second button is not affected for all (1.-4.) conditions? 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