how to Imagesearch with soundplay

Ask gaming related questions
Shuu148
Posts: 39
Joined: 11 May 2023, 21:25

how to Imagesearch with soundplay

08 Jan 2024, 06:10

Hello guys. I'm getting an error here. I'm trying to play this sound when the image is found.

Code: Select all

CheckForImage() {

  if (ImageSearch(&FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*50 G:\Test\finish.png"))
    {
      SoundPlay "G:\Test\FinishHim.mp3"
    }

}

"C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" /ErrorStdOut "G:\Test\lowlife.ahk"

sorry its not an error, but i cant execute that.
Last edited by Shuu148 on 08 Jan 2024, 06:18, edited 1 time in total.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: how to Imagesearch with soundplay

08 Jan 2024, 06:16

What's the error message?
"C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" /ErrorStdOut "G:\Test\lowlife.ahk"
Do you mean this? This is not an error message, just the command line which your editor used to run the file.
That said, if you never call the defined function, your code above won't do anything... and just exit.

Edit (after the original post was edited):
sorry its not an error, but i cant execute that.
Why not? It just doesn't do anything, as long as you don't call the function. Add q::CheckForImage() or smth similar to test. A (temporary) else-branch could also help.
Shuu148
Posts: 39
Joined: 11 May 2023, 21:25

Re: how to Imagesearch with soundplay

08 Jan 2024, 06:49

Sorry my fault. I got it thx.

Return to “Gaming Help (v2)”

Who is online

Users browsing this forum: No registered users and 12 guests