Jump to content
Sign in to follow this  
mortog

if WinActive (StringInStr) (etc.)

Recommended Posts

mortog

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

Share this post


Link to post
Share on other sites
ajag

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)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.