Jump to content

if WinActive (StringInStr) (etc.)


Recommended Posts

hey folks,

I'm trying to write a little program that keeps looping and checks if the active window contains the string 'Confirm' and if so will give a right arrow and enter key input, however what I've got so far isn't working.

I'm probably completely overlooking something small here, but I have a bit of a blackout and was wondering if someone could tell me where I'm going wrong.

Thanks in advance!

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc

Sleep(2500)

While 1
    If WinActive (StringInStr(WinGetTitle("[Active]"), "Confirm" )) Then 
        Send ("{Right}")
        Sleep(200)
        Send ("{Enter}")
    Else

    EndIf

    Sleep(2500)
WEnd
Link to comment
Share on other sites

Do you mean this?

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc

Sleep(2500)

While 1
    If StringInStr(WinGetTitle("[Active]"), "Confirm" ) Then
        Send ("{Right}")
        Sleep(2000)
        Send ("{Enter}")
    Else

    EndIf

    Sleep(2500)
WEnd

A-Jay

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

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...