JohnTWI Posted August 25, 2020 Share Posted August 25, 2020 I am trying to click a button from a menu. The code below clicks the center button of the menu (the rotate 45 degrees button). I would like to click on the "PDF" button four buttons to the right. ControlClick("", "", "[CLASS:ToolBarWindow32; INSTANCE:1; ID:59392]") Thank you in advance Link to comment Share on other sites More sharing options...
Nine Posted August 25, 2020 Share Posted August 25, 2020 (edited) Try using : _GUICtrlToolbar_ButtonCount See if you have access to individual button, if so then use the UDF to loop thru the toolbar until you find the PDF button. Edit : just so you understand, controlClicking a toolbar control will simply click in the center of it... Edited August 25, 2020 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...
Moderators JLogan3o13 Posted August 25, 2020 Moderators Share Posted August 25, 2020 (edited) Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Edited August 25, 2020 by JLogan3o13 "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! Link to comment Share on other sites More sharing options...
Zedna Posted August 25, 2020 Share Posted August 25, 2020 (edited) Use Au3Info.exe - ToolBar page where is shown: Index/CommandID/Text Use these information by ControlCommand(..., "SendCommandID", ...) Quote Simulates the WM_COMMAND message. Usually used for ToolbarWindow32 controls - use the ToolBar tab of Au3Info to get the Command ID. https://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm Edited August 25, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 Zedna Do you have an example? I am still not getting the syntax to select a specific button via ControlCommand Thank you in advance Link to comment Share on other sites More sharing options...
Zedna Posted August 25, 2020 Share Posted August 25, 2020 (edited) ; Title/Text (of target app) params should be given accordingly ; 1234 -> Command ID from Au3Info/ToolBar ControlCommand("", "", "ToolBarWindow321", "SendCommandID", 1234) or this - your way of identifying of ToolBar control: ControlCommand("", "", "[CLASS:ToolBarWindow32; INSTANCE:1; ID:59392]", "SendCommandID", 1234) Edited August 25, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 Zedna - thank you for the feedback I tried code below, did not work, attaching screen shot of Summary Tab, I am looking to click on the PDF button ControlCommand("", "", "ToolBarWindow321", "SendCommandID", 32777) Link to comment Share on other sites More sharing options...
Zedna Posted August 25, 2020 Share Posted August 25, 2020 (edited) Try this ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32777) or this ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", "32777") EDIT: and try every Command ID for toolbar buttons 1-10 to see if some buttons will work Edited August 25, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 Zedna I tried the following, with and without quotes no luck ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32773) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 57603) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 0) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32777) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32771) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32776) ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32774) Link to comment Share on other sites More sharing options...
Nine Posted August 25, 2020 Share Posted August 25, 2020 (edited) Mind running it : #include <Constants.au3> #include <GuiToolbar.au3> Local $hWnd = WinGetHandle("PATHOLOGY REPORTS") Local $hCtrl = ControlGetHandle($hWnd, "", "ToolbarWindow321") ConsoleWrite ($hWnd & "/" & $hCtrl & @CRLF) ConsoleWrite (_GUICtrlToolbar_ButtonCount ($hCtrl) & @CRLF) For $i = 0 to _GUICtrlToolbar_ButtonCount ($hCtrl)-1 $b = _GUICtrlToolbar_IndexToCommand($hCtrl,$i) $t = _GUICtrlToolbar_GetButtonText($hCtrl,$b) ConsoleWrite ($i & "/" & $b & "/" & $t & @CRLF) Next So we know more about this toolbar. Post console result. Edited August 25, 2020 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...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 Results posted below, also the document is a .csd file >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\ProductionVER2\zzzButtonTester.au3" 0x005304E8/0x00590164 16 0/32773/ 1/57603/ 2/0/ 3/32771/ 4/32772/ 5/32776/ 6/32775/ 7/0/ 8/32774/ 9/32777/ 10/32778/ 11/32780/ 12/0/ 13/32789/ 14/57607/ 15/57664/ >Exit code: 0 Time: 0.2402 Link to comment Share on other sites More sharing options...
Nine Posted August 25, 2020 Share Posted August 25, 2020 (edited) Looking good. Add this at the end of the script, let's see if that works : ConsoleWrite (ControlCommand($hWnd, "", $hCtrl, "SendCommandID", 32789) & @CRLF) Edited August 25, 2020 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...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 I pasted after the Next >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\ProductionVER2\zzzButtonTester.au3" 0x005304E8/0x00590164 16 0/32773/ 1/57603/ 2/0/ 3/32771/ 4/32772/ 5/32776/ 6/32775/ 7/0/ 8/32774/ 9/32777/ 10/32778/ 11/32780/ 12/0/ 13/32789/ 14/57607/ 15/57664/ 0 >Exit code: 0 Time: 0.2491 Link to comment Share on other sites More sharing options...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 Sorry forgot to add it did not click the PDF button Link to comment Share on other sites More sharing options...
Nine Posted August 25, 2020 Share Posted August 25, 2020 Hmm, then add those lines instead : WinActivate ($hWnd) WinWaitActive ($hWnd) _GUICtrlToolbar_ClickButton ($hCtrl, 32789, "left", True) “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...
JohnTWI Posted August 25, 2020 Author Share Posted August 25, 2020 That worked Thank you “Petit a petit, l’oiseau fait son nid” Link to comment Share on other sites More sharing options...
Nine Posted August 25, 2020 Share Posted August 25, 2020 À la prochaine ! “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...
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