TouchOdeath Posted May 12, 2009 Share Posted May 12, 2009 (edited) This is just a simple script to see if the control has focus or not. All you have to do is say: if ControlGetFocus($handle) <> "" then ;do this code endif Example Script: Run("notepad.exe") While ControlGetFocus("[CLASS:Notepad]") = "" sleep(1) WEnd MsgBox(0,ControlGetFocus("[CLASS:Notepad]"),"") In this example its kindof used in place of winwait. But its interesting just because I have never thought of ControlGetFocus like that. Because it returns the ClassNN and I thought to myself "well what good is that" and now it just occured to me. If ControlGetFocus returns "" then the control isnt there or isnt focused. Edited May 12, 2009 by TouchOdeath Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 12, 2009 Share Posted May 12, 2009 You missed something:sleep(1) should be sleep(10) or maybe sleep(0). I don't blame you since it is not documented, but I thought you may want to know that for the future. You can read more about that in THIS thread. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
TouchOdeath Posted May 12, 2009 Author Share Posted May 12, 2009 (edited) You missed something:sleep(1) should be sleep(10) or maybe sleep(0). I don't blame you since it is not documented, but I thought you may want to know that for the future. You can read more about that in THIS thread. I was aware of that. sleep(1) or sleep(0) will work itself out to be sleep(10) anyways. So the problem fixes itself, but ya thanks for pointing that out. Edited May 12, 2009 by TouchOdeath 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