Sign in to follow this  
Followers 0
TheLandYacht

How to make keypress only seen when AutoIt script is "active"

3 posts in this topic

OK. So, I built my first script. I got it working exactly (almost) how I want it to. Only one small problem that someone will probably say "duh" at me for. In line 61, I use _IsPressed to watch for a keystroke (enter) as the trigger to accomplish what the script's built for. Problem is, it watches for ANY time the enter key's pressed, no matter whether the script window's the topmost window or not. So, I'll be typing away in my word-processor, hit enter...and it triggers the script. How do I fix that, make it so it's only triggered if the script window is topmost? Below is the part of the script I'm pretty sure is the relevant portion.

Suggestions?

While 1

    SendKeepActive("TrueSMS")


    If _IsPressed("0D") Then
        ClipPut ($aData[_GUICtrlComboBox_GetCurSel($hCombo)][1])
        Opt("WinTitleMatchMode", 2)
        WinActivate ( "TrueSMS" )
        Send("^v")
    EndIf

    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $hButton
            MsgBox(0,"",$aData[_GUICtrlComboBox_GetCurSel($hCombo)][1])

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



I didn't use all of what you have there, but your advice DID point me in the right direction! Thanks!

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  
Followers 0