Paxman Posted June 14, 2018 Posted June 14, 2018 Just seem to have hit a bit of a hurdle. I am trying to get Autoit to tick a box in a dialogue box. However no windows shortcut works (eg. spacebar etc.). So having moved to the tick box (how can i produce a double click of the mouse (which ticks the box) without moving the mouse each time. I will need to do this many times in a tall dialogue box you need to scroll through if trying to use the mouse to do it? Can i map a keyboard shortcut or something? Thanks Neil
careca Posted June 14, 2018 Posted June 14, 2018 what does the au3 window tool says about that checkbox? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Paxman Posted June 14, 2018 Author Posted June 14, 2018 Did not know of this tool but found it. Clicking the tick box gives me this. Not sure if it helps. Thanks Neil >>>> Window <<<< Title: GridTrader Class: #32770 Position: 613, 20 Size: 626, 754 Style: 0x94CC20C4 ExStyle: 0x00010501 Handle: 0x004F0B3C >>>> Control <<<< Class: SysListView32 Instance: 1 ClassnameNN: SysListView321 Name: Advanced (Class): [CLASS:SysListView32; INSTANCE:1] ID: 1357 Text: List1 Position: 18, 37 Size: 577, 601 ControlClick Coords: 47, 177 Style: 0x5021940D ExStyle: 0x00000204 Handle: 0x00C70BF6 >>>> Mouse <<<< Position: 686, 265 Cursor ID: 0 Color: 0xDBEAEC >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Inputs List1 &Load &Save OK Cancel Reset >>>> Hidden Text <<<< 1 false None 2018.06.14 20:37:00
Zedna Posted June 14, 2018 Posted June 14, 2018 Look at this: https://www.autoitscript.com/autoit3/docs/functions/ControlGetHandle.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_SetItemChecked.htm Resources UDF ResourcesEx UDF AutoIt Forum Search
Paxman Posted June 14, 2018 Author Posted June 14, 2018 Not sure what to do with this as my knowledge of this scripting language is elementary. Do i somehow modify the function to retrieve the Handle of the control and then somehow use the SetItemChecked function to check the control? If so can you help with an example or give a few more pointers? Thanks for your help.
Zedna Posted June 14, 2018 Posted June 14, 2018 (edited) Try this: #include <GuiListView.au3> $hLV = ControlGetHandle("GridTrader", "", "SysListView321") _GUICtrlListView_SetItemChecked($hLV, 0) It should set checked state for the first row in your ListView. If it will work, you can easily accomodate it to set checked state to desired rows ... Edited June 14, 2018 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Paxman Posted June 15, 2018 Author Posted June 15, 2018 Ok that seems to make some sense to me now. I will give it a go. Thanks for your help here
Paxman Posted June 15, 2018 Author Posted June 15, 2018 (edited) Am i right in thinking that i can use the info in au3 window info (as below) to click a button. Like ControlClick($hWnd, "", "[Class:Button;Instance:1]") Or is it better to use an ID? >>>> Window <<<< Title: OANDA - MetaTrader - [EURGBP,M5] Class: MetaQuotes::MetaTrader::4.00 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 Name: Advanced (Class): [CLASS:Button; INSTANCE:1] ID: 1025 Text: Expert properties Edited June 15, 2018 by Paxman
Zedna Posted June 15, 2018 Posted June 15, 2018 Use ClassNN: ControlClick($hWnd, "", "Button1") Resources UDF ResourcesEx UDF AutoIt Forum Search
Paxman Posted June 15, 2018 Author Posted June 15, 2018 (edited) I created a simple script to test this and it errors. #include <MsgBoxConstants.au3> ; This is my first script MsgBox($MB_SYSTEMMODAL, "My First Script!", "Hello World!") ControlClick($hWnd, "", "Button1") err $hWnd possibly used before declaration and err undeclared global variable. So in VBA i would know where to look but i am stumped here. Also once it has errored how can i get back to a screen without the error codes on please. thanks Neil Edited June 15, 2018 by Paxman
Paxman Posted June 15, 2018 Author Posted June 15, 2018 (edited) After some googling i added global $hwnd to start and error went. However i think i need something before the button click to tell it what window to go to? can i use this function i found in the recorder Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc and then use _WinWaitActivate("9762353: OANDA - MetaTrader - [EURGBP,M5]","") Or is that not the way to do it? Edited June 15, 2018 by Paxman
Moderators JLogan3o13 Posted June 15, 2018 Moderators Posted June 15, 2018 $hWnd is the variable that refers to the window. Look at the example for ControlClick in the help file; it shows you everything you need to know. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Paxman Posted June 15, 2018 Author Posted June 15, 2018 Got it worked perfectly! Help is good, knowing where to look is the thing
Moderators JLogan3o13 Posted June 15, 2018 Moderators Posted June 15, 2018 21 minutes ago, Paxman said: Help is good, knowing where to look is the thing Every function in AutoIt has a page in the help file, many with not one but multiple examples... "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Paxman Posted June 15, 2018 Author Posted June 15, 2018 15 hours ago, Zedna said: Try this: #include <GuiListView.au3> $hLV = ControlGetHandle("GridTrader", "", "SysListView321") _GUICtrlListView_SetItemChecked($hLV, 0) It should set checked state for the first row in your ListView. If it will work, you can easily accomodate it to set checked state to desired rows ... Hi i got the code to run but it does not tick the control. I tried 0,1 and 2 to be sure. Is there another way to do this? As mentioned before, in use you can only use the mouse with a left click or double click. No Keyboard shortcut exists. Thanks Neil
Zedna Posted June 15, 2018 Posted June 15, 2018 Add error checking to see where is problem: If @error Then ... Resources UDF ResourcesEx UDF AutoIt Forum Search
Paxman Posted June 15, 2018 Author Posted June 15, 2018 i have set windows Ease of use to use the + key on the numeric keypad as a double click so we could just navigate to each line using {down} and then setting or unsetting? Is this a possible method?
Paxman Posted June 15, 2018 Author Posted June 15, 2018 mmm seems to only work if cursor is on the required line. Back to scripting it if possible.
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