MrHeadScratcher Posted December 7, 2010 Share Posted December 7, 2010 Hi,I started yesterday using AutoIT. I want to automate document scanning using FreeOCR. At the moment I am stuck because I am not able to access my toolbar.Here is my code:Run("C:\Program Files\FreeOCR\FreeOCR.exe") WinActivate("FreeOCR V3 Free OCR Software") $var = ControlClick("[CLASS:WindowsForms10.window.8.app.0.33c0d9d]", "ToolStrip1", "198670") MsgBox($var)I tried all possible variations of ControlClick parameters and I always get the message "==> Incorrect number of parameters in function call.:". What am I doing wrong? I don't want to use MouseClick.best, MHS Link to comment Share on other sites More sharing options...
Mat Posted December 7, 2010 Share Posted December 7, 2010 I think you are missing out the text parameter: ControlClick("Title", "Text", "Control", "primary", 1, $x, $y) Have you tried using GUIToolbar UDF?? Use #include<GUIToolbar.au3>, and then you want functions like _GUICtrlToolbar_ClickIndex. It should be more reliable than relying on x and y coords. Something like: #include<GUIToolbar.au3> $i = 0 ; Index to click $hToolbar = ControlGetHandle("Window Title", "", "Toolbar1") _GUICtrlToolbar_ClickIndex($hToolbar, $i) Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
MrHeadScratcher Posted December 7, 2010 Author Share Posted December 7, 2010 Hi,I tried your suggestion but I am stuck now because I don't know the index paramter:#Include <GuiToolBar.au3> _GUICtrlToolbar_ClickIndex($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])I also can't use ClickButton because of the command id:#Include <GuiToolBar.au3> _GUICtrlToolbar_ClickButton($hWnd, $iCommandID[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])Is there a function to get this info?best, MHS Link to comment Share on other sites More sharing options...
Mat Posted December 7, 2010 Share Posted December 7, 2010 The index is simple, you count what number the item is. For the Command Id, there is a 'Toolbar' tab in the window info tool that ships with AutoIt. It lists all the toolbar items Id and Text. AutoIt Project Listing Link to comment Share on other sites More sharing options...
MrHeadScratcher Posted December 7, 2010 Author Share Posted December 7, 2010 Hi, I have no entries in Toolbar tab only empty columns "Index", "Command ID" and "Text". best, MHS Link to comment Share on other sites More sharing options...
Varian Posted December 7, 2010 Share Posted December 7, 2010 This toolbar is not "Windows Standard" so you'll have to use coordinates. The good news is that this toolbar cannot be resized so your coordinates should be the same (or at least similar if you click on the middle of the button with the AU3 Window INfo Tool) desktop resolution. Link to comment Share on other sites More sharing options...
MrHeadScratcher Posted December 7, 2010 Author Share Posted December 7, 2010 Hi,Ok. I use now Mouseclick. If I maximize the window before all button-positions will be the same. Thanks for the help.best, MDS Link to comment Share on other sites More sharing options...
Varian Posted December 7, 2010 Share Posted December 7, 2010 You do not have to maximize the Window if you don't want to. My toolbar is always 65 pixels high, maximized or not. The x coordinate of the buttons does not change either. So if you just specify the X coordinate of the button you want to click, it should work. This works for me on the Open PDF buttonOpt('WinTitleMatchMode', 4) ControlClick("[CLASS:WindowsForms10.window.8.app.0.378734a]", "", "ToolStrip1", "left", 1, 174) 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