TheLandYacht Posted March 17, 2010 Share Posted March 17, 2010 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 Link to comment Share on other sites More sharing options...
picaxe Posted March 17, 2010 Share Posted March 17, 2010 Something like#include <Misc.au3> $hGui = GUICreate("test") GUISetState(@SW_SHOW) $dll = DllOpen("user32.dll") While 1 If _IsPressed("0D", $dll) And WinActive($hGui) Then MsgBox(262144,"_IsPressed", "Return Pressed") If GUIGetMsg() = -3 Then ExitLoop Sleep(10) WEnd DllClose($dll) Link to comment Share on other sites More sharing options...
TheLandYacht Posted March 17, 2010 Author Share Posted March 17, 2010 I didn't use all of what you have there, but your advice DID point me in the right direction! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now