Ok, so I'm smashing my head with autoit and tesseract and I have a problem. The code works and does what it needs to do on one environment but not on another. When running it on Windows Server 2012 (2 DELL monitors connected) it works, but when I used on my home environment, Windows 8 (2 TVs connected) it does not.
Here is the code:
#include <SimpleTesseract.au3>
#include <ScreenCapture.au3>
#include <Array.au3>
#include <String.au3>
GLOBAL $var1
GLOBAL $num1
GLOBAL $var2
GLOBAL $num2
GLOBAL $diff
GLOBAL $x
GLOBAL $z
;Tesseract Path for temp files (where you put the app)
_TesseractTempPathSet("D:\AUTOIT")
;Get First Val Screenshot
SplashImageOn ( "Test", "D:\AUTOIT\tst1.jpg" , 135 , 30 , 0 , 0, 1)
sleep(200)
_ScreenCapture_Capture("D:\AUTOIT\TEST1.jpg", 0, 0, 135, 30)
sleep(1000)
;Get First Val
SplashImageOn ( "Test", "D:\AUTOIT\TEST1.jpg" , 135 , 30 , 0 , 0, 1)
sleep(200)
$var1 = _TesseractScreenCapture(0, "", 0, 3, 0, 0, 135, 30, 0)
sleep(200)
;Get Second Val Screenshot
SplashImageOn ( "Test", "D:\AUTOIT\tst2.jpg" , 135 , 30 , 0 , 0, 1)
sleep(200)
_ScreenCapture_Capture("D:\AUTOIT\TEST2.jpg", 0, 0, 135, 30)
sleep(1000)
;Get Second Val
SplashImageOn ( "Test", "D:\AUTOIT\tst2.jpg" , 135 , 30 , 0 , 0, 1)
sleep(200)
$var2 = _TesseractScreenCapture(0, "", 0, 4, 0, 0, 135, 30, 0)
sleep(200)
;Parse First Val
$var1 = StringReplace($var1, ",", "")
$num1 = Number($var1)
;Parse Second Val
$var2 = StringReplace($var2, ",", "")
$num2 = Number($var2)
;Calculate
$diff = $num2 - $num1
;Parse XP Number ===========================
$x = StringLen($diff)
$z = Int($x/3)
if IsInt($x/$z) then
if $z = 1 Then
$diff = _StringInsert ($diff, ",", $x-3); under 1,000,000 XP
else
for $i = 1 to $z-1
$diff = _StringInsert ($diff, ",", $x-3*$i); under 1,000,000,000 XP
Next
endif
else
for $i = 1 to $z
$diff = _StringInsert ($diff, ",", $x-3*$i); under 1,000,000,000,000 XP
Next
Endif
;End Of Parse XP Number ====================
;Display
Tooltip("First Image: " & $var1 & " Second Image: " & $var2 & " Difference: " & $diff, 500, 0)
sleep(10000)
Here are the needed files:
http://www.filedropper.com/simpletesseract
http://www.filedropper.com/tst1
http://www.filedropper.com/tst2
Please help if you have any idea.
You should always set it up with 0 at the end. It always does something. If it "does" nothing when set with 0 at the end it means that the array is null. When you set it up with 1 at the end you will get that error which you stated. Also if you configured a path two files will be created.
Random name having the following:
1. file .tiff with image on which tesseract performs OCR
2. file .txt with result after ocr was performed on image
Here is an image if it is not clear:
http://www.filedropper.com/explanation