Code: Select all
FText:=FindText_OcrOK(FindText(0, 0, 600, 600, 0.01, 0, TxtLetters))
Txt:=FText.ocr
MsgBox, % Txt
Code: Select all
FText:=FindText_OcrOK(FindText(0, 0, 600, 600, 0.01, 0, TxtLetters))
Txt:=FText.ocr
MsgBox, % Txt
I downloaded and compile it into an exe file. But when running the exe file, nothing happens! The program does not appear! Please everyone help@@ed1chandler wrote: ↑20 May 2016, 09:34Want to make sure I'm understanding use case and usage:
1) Download script and run it. This pops up the "Catch Image To Text And Find Text Tool" box with "Catch", "Test", and "Copy" buttons.
2) Click the "Catch" button and the cursor is accompanied by a transparent red box.
3) Move the red box over the text you want to search for and click, then move the box more than 100 px in any direction to trigger capture.
4) This brings up the "Catch Image To Text" box with a magnified view of the captured text.
5) The lower left portion of that GUI has a series of "trimming" buttons, used to trim the edges of the captured region. I'm not sure what the abbreviations are supposed to stand for, but it appears that "LD" trims one pixel from the left edge, "LD3" trims three pixels, and the other buttons do the same for "up", "down", and "right." Use those buttons to trim the region down to what you really want to search for.
6) Click somewhere on the magnified capture to select a pixel with the color you want to use for matching. When you do, the text box next to the "Color2Two" button will populate with the hex value of the color corresponding with the pixel you chose.
It appears there are two modes: color and greyscale. If you want to use color, it appears to go something like this:
7a) After selecting a pixel (step 6), if you click the "Color2Two" button, it appears to convert the magnified image into a two-tone version where all pixels of the selected color are converted to black and all other pixels are converted to white.
And if you want to use greyscale, it goes something like this:
7b) After selecting a pixel (step 6), if you click the "Gray2Two" button, it appears to make a "best guess" at a threshold, then convert the magnified image into a two-tone black/white version where all pixels on one side of the threshold are black and all others are white. It also appears that you can change the threshold and click the button again if you want to adjust the program's guess.
8) Once you've got the two-tone image you want, click the "Ok" button. This returns a GUI with a "Text=..." block of text and a related function call. You can click the "Test" button to test that the search will actually find what you're looking for, then click the "Copy" button to copy the text block and the related function call to the clipboard. The "Exchange" button will negate the image and the "Load" button will reload the original capture.
9) Copy that block of text and the function call into the script from which the search will be run ... and be sure the script can "see" the FindText() function.
10) Modify and enjoy.
What I'm *not* quite following is how to modify the function parameters. The "w" and "h" parameters say that they're "offsets" but what does that *mean*? (i.e. What's the effect of changing them?) The default is 150, but the capture tool seeds these to 150000. What is this changing?
You don't need to compile the FindText.ahk Just run the script itself.
Code: Select all
Gui, _MouseTip_: Color, % A_Index & 1 ? "Red" : "Blue"
Sleep, 500
I don't know the content of your code, but maybe you forgot to add the necessary things for speed.chaoscreater wrote: ↑05 May 2020, 04:17Hi there,
I came across your script and tested it and it works great! It's awesome, I love it!
One small problem I have is that the execution of the script is a bit slow. I'm using your script to automate clicking between 2 images on my screen. The images are not always in the same location, hence why I'm using your script. The problem is that there's a delay between each click. So 1st image is clicked and then there's a small wait delay before the 2nd image is clicked.
I found that the delay seems to mostly come from this bit:
So I adjusted it to Sleep, 100 and that made it run a lot faster. However, there's still a small delay. I would like the click to be near instant. I couldn't find anything else to adjust to make it click faster. Any ideas?Code: Select all
Gui, _MouseTip_: Color, % A_Index & 1 ? "Red" : "Blue" Sleep, 500
Code: Select all
SetBatchLines, -1
Code: Select all
for i,v in ok
;if (i<=2) ; limit number of clicks to two
;FindText_MouseTip(ok[i].x, ok[i].y) ; don't use this line
;MouseMove, ok[i].x, ok[i].y ; move the mouse to found position(s)
MouseClick,, ok[i].x, ok[i].y ; click to found positon(s)
;Click, % ok[i].x "," ok[i].y ; click to found positon(s) (alternative)
Not possible.chaoscreater wrote: ↑09 May 2020, 04:55Is it possible to edit an existing image found by FindText? Like, can we paste the code back into the software to make a quick edit?
>"C:\Program Files\AutoHotkey\SciTE\..\AutoHotkey.exe" /ErrorStdOut "C:\Users\admin\Desktop\FindText.ahk"OMGmarc wrote: ↑28 Apr 2020, 09:18You don't need to compile the FindText.ahk Just run the script itself.
Steps:
1. Copy the code from the OP.
2. Paste it into a blank text file.
3. Save the text file as FindText.ahk.
4. Double click on FindText.ahk to launch FindText.
et voila, start capturing and saving text strings.
Could hint to an AHK version that is too old.rinjp727 wrote: ↑10 May 2020, 06:17>"C:\Program Files\AutoHotkey\SciTE\..\AutoHotkey.exe" /ErrorStdOut "C:\Users\admin\Desktop\FindText.ahk"
C:\Users\admin\Desktop\FindText.ahk (71) : ==> This line does not contain a recognized action.
Specifically: local
>Exit code: 2 Time: 0.1478
Please help me.!!!
Code: Select all
Text:="|<0>*147$6.SnVVVVVnSU"
Text.="|<1>*147$5.9kV248Hw"
Text.="|<2>*148$6.yX11248EzU"
Text.="|<3>*149$6.yX13C11XyU"
Text.="|<4>*149$6.66+GmWz22U"
Text.="|<5>*149$6.TEES311XyU"
Text.="|<6>*148$6.CEUyXVVnSU"
Text.="|<7>*149$6.z1224A8MEU"
Text.="|<8>*148$6.SnVnSVVnSU"
Text.="|<9>*148$6.SnVVlT12QU"
Code: Select all
; #Include <FindText>
;t1:=A_TickCount, X:=Y:=""
Text:="|<>*196$20.0zk0zz0w1wC0777stVz6kzlw6wT0DDk7rw3tz0w7kD1y3URUw6QD3XXVkzVw3zw0Dw2" ; use your own snippet code!
F11::
if (ok:=FindText(855-150000, 89-150000, 855+150000, 89+150000, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
}
Return
;MsgBox, 4096, Tip, % "Found :`t" Round(ok.MaxIndex())
;. "`n`nTime :`t" (A_TickCount-t1) " ms"
;. "`n`nPos :`t" X ", " Y
;. "`n`nResult:`t" (ok ? "Success !" : "Failed !")
;for i,v in ok
;if (i<=2)
;FindText_MouseTip(ok[i].x, ok[i].y)
;===== Copy The Following Functions To Your Own Code Just once =====
...
Yes, it's possible, but currently not user friendly! Try to change e.g. the last letter/number in Text.="|<2>*148$6.yX11248EzU" to the one which precedes/follows the existing and you will get the idea how to do it.chaoscreater wrote:Is it possible to edit an existing image found by FindText? Like, can we paste the code back into the software to make a quick edit?
Return to “Scripts and Functions (v1)”
Users browsing this forum: wilkster and 43 guests