I don't know I'm getting this error in FindText.ahk File? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
God108
Posts: 9
Joined: 25 Jan 2023, 03:47

I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 25 Jan 2023, 04:18

This is My code
image.png
image.png (44.31 KiB) Viewed 883 times
I'm Trying to Make a Game Farm Harvesting Bot using FindText Image Recognition Feature but it is showing some error in the Main Freshly File I downloaded from Forum FindText.ahk
image.png
image.png (62.35 KiB) Viewed 883 times
Error Line:
image.png
image.png (22.94 KiB) Viewed 883 times

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: I don't know I'm getting this error in FindText.ahk File?

Post by swagfag » 25 Jan 2023, 05:21

ure including a function written for ahk_v1 in an ahk_v2 script. unless there exists a FindText() function written for ahk_v2, clearly this wont work

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 25 Jan 2023, 06:13

@swagfag
Oh So, I have to write v1 Script to use FindText I see. and One MOre questions I have How do i make it that when My Application is open, active and in focus then only my scipt or hotkey work, because HotifWinActive (v2 version ) is not working, its even when my game is closed its running key Binding which i fixed for game.

User avatar
mikeyww
Posts: 26942
Joined: 09 Sep 2014, 18:38

Re: I don't know I'm getting this error in FindText.ahk File?

Post by mikeyww » 25 Jan 2023, 06:40

It isn't HotifWinActive. It's #HotIf WinActive(.... Example

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 25 Jan 2023, 13:34

@mikeyww But it still showing this, MAybe ahk v2 lanugae support extension issue? right

Image

[Mod edit: Added img tags to image link.]

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: I don't know I'm getting this error in FindText.ahk File?

Post by boiler » 25 Jan 2023, 14:11

There is a HotIf. It's just that you should have used #HotIf.

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 25 Jan 2023, 15:07

@boiler Btw I'm not able to run Findtext 🥲
image.png
image.png (124.28 KiB) Viewed 747 times
this is ahk v1 script now so what's the issue?
image.png
image.png (25.94 KiB) Viewed 747 times

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: I don't know I'm getting this error in FindText.ahk File?

Post by boiler » 25 Jan 2023, 15:56

Where did FindText_Left_Click() come from? I don't see that within the FindText class. Is that something you made up?

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 26 Jan 2023, 02:32

@boiler
From the Youtuber Automator
image.png
image.png (213.15 KiB) Viewed 696 times
See🙂 Or Else I don'y know exactly how to use this FindText

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 26 Jan 2023, 02:49

@boiler
Well now without Any Error its Running but not executing? Any Idea?

Code: Select all

#Include, FindText.ahk ;its in the same folder

#IfWinActive, ahk_exe DragonCity.exe
    z::

        MouseClick, left, 534, 650
    Return

    A::
        Text:="|<>*170$52.zz7zzzzzzzkDzzzzzzy1zzzzzzzkTzzzzzzz1zzzzzzzw7jzzzzzzk8zzzzzzz03zzzz0Ds0Tzzzw1z03zzzzsDs7zzzzzlz0zzzzzzzs7zzzzzzz0zzzzzzzs3zzzzzzz0Tzzzzzzw3zzzzzzzsTzzzzzzzrzzzzzzzy"

        if (ok:=FindText(X, Y, 578-150000, 954-150000, 578+150000, 954+150000, 0, 0, Text))
        {
            FindText().Click(X, Y, "L")
        }
        else
        {
            MsgBox, % "Not found"
        }
return

#IfWinActive

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: I don't know I'm getting this error in FindText.ahk File?

Post by boiler » 26 Jan 2023, 04:19

You ran it, pressed A when DragonCity was the active window, then it didn’t click or show a MsgBox? Do you know that DragonCity.exe is the process name?

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 26 Jan 2023, 07:04

Yea it worked Now, I forgot I was using the Sample image on My application, But yea even when it couldn't find it it was not showing "not found" but anyway, it working now. THank you so much for your assistance 🙇😆. Btw do you know how I can make my script wait for particular second and then continue script, Like I want to make automated script for the game, to watch ad, so i need to wait for 30 sec until game show [X] button to close ad and then 2 second to wait for reward to claim. Thought i did find set interval, so it working? or there is something else?@boiler

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: I don't know I'm getting this error in FindText.ahk File?

Post by boiler » 26 Jan 2023, 07:11

Are you looking for the Sleep command?

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 28 Jan 2023, 06:43

@boiler Oh yea it's working. hey do you know? how can i Use find text in this way?
like, A loop will be keep running until My Script can find image, and stop when it can't fiind anymore

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: I don't know I'm getting this error in FindText.ahk File?  Topic is solved

Post by boiler » 28 Jan 2023, 07:53

Like this:

Code: Select all

Text:="|<>*170$52.zz7zzzzzzzkDzzzzzzy1zzzzzzzkTzzzzzzz1zzzzzzzw7jzzzzzzk8zzzzzzz03zzzz0Ds0Tzzzw1z03zzzzsDs7zzzzzlz0zzzzzzzs7zzzzzzz0zzzzzzzs3zzzzzzz0Tzzzzzzw3zzzzzzzsTzzzzzzzrzzzzzzzy"
while !FindText(X, Y, 578-150000, 954-150000, 578+150000, 954+150000, 0, 0, Text)
	Sleep, 50
while FindText(X, Y, 578-150000, 954-150000, 578+150000, 954+150000, 0, 0, Text)
	Sleep, 50
MsgBox, Image was initially found and now is no longer found.

God108
Posts: 9
Joined: 25 Jan 2023, 03:47

Re: I don't know I'm getting this error in FindText.ahk File?

Post by God108 » 28 Jan 2023, 08:39

Ooh 😮Got it Thanks you so much man 🙇I will get back to you again 😁😂 If I encounter any Bug again@boiler

Post Reply

Return to “Gaming Help (v1)”