Jump to content

Free OCR and AutoIT


Recommended Posts

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

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

Link to comment
Share on other sites

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

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

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 button

Opt('WinTitleMatchMode', 4)
ControlClick("[CLASS:WindowsForms10.window.8.app.0.378734a]", "", "ToolStrip1", "left", 1, 174)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...