stackover Posted January 29, 2007 Share Posted January 29, 2007 Im trying to send only a simple "V" to MU Online but always send in window that was active in the moment... Is controlsend ... send to background windows or inactive? Im trying this HotKeySet("{PAUSE}","Teste") while 1 Sleep(1000) WEnd Opt("WinTitleMatchMode",1) Func Teste() Opt("WinTitleMatchMode",1) ;Run("Notepad.exe") WinActivate("MU", "") ;ControlGetFocus("Documento - WordPad", "") ;ControlSend("Untitled - Notepad",15,") ControlSend("MU", "", "","v") Exit EndFunc Link to comment Share on other sites More sharing options...
improbability_paradox Posted January 29, 2007 Share Posted January 29, 2007 (edited) Im trying to send only a simple "V" to MU Online but always send in window that was active in the moment... Is controlsend ... send to background windows or inactive? Im trying this HotKeySet("{PAUSE}","Teste") while 1 Sleep(1000) WEnd Opt("WinTitleMatchMode",1) Func Teste() Opt("WinTitleMatchMode",1) ;Run("Notepad.exe") WinActivate("MU", "") ;ControlGetFocus("Documento - WordPad", "") ;ControlSend("Untitled - Notepad",15,") ControlSend("MU", "", "","v") Exit EndFunc In most cases, ControlSend will send to a control on a window, regardless of that windows status or whether or not it is active. The thing to remember is that ControlSend is meant to send a keystroke to a control, not just a window. It can work sometimes, but not always. It will be more reliable if you are able to specify a ContolID/ClassNameNN, (for example, in notepad it is "Edit1") but in some cases these are not available. Even with the ControlID, it may not work if the application is not using standard windows controls. A question; is MU online a game that you play through a browser? (I ask out of ignorance, I have never heard of this game before). If it is, you may be able to use the _IE() functions to interact with it. Don't ask me how, I have never used them. Also, ControlSend works differently in the latest (3.2.2.0) version of AutoIt than it did in previous versions, so if you are unable to get the desired results with the latest stable release, try an older version of AutoIT. It is going to be changed again in the next release so that it will be closer to how it was before. Edited January 29, 2007 by improbability_paradox Link to comment Share on other sites More sharing options...
stackover Posted January 29, 2007 Author Share Posted January 29, 2007 (edited) I read that ControlSend doesn't work in 3.2.2.0. Anyway how to discovery ContolID/ClassNameNN of aplication that I want send controls ? Edited January 29, 2007 by stackover Link to comment Share on other sites More sharing options...
improbability_paradox Posted January 29, 2007 Share Posted January 29, 2007 (edited) With respect to ControlSend() to an empty control parameter... ""In 3.2.2.0 AutoIt sends a global keystroke.. It is a change from previous versions...In 3.2.3.0 It will PostMessage to the window provided... in your case "MU".Stay tuned for 3.2.3.0 or use a previous AutoIt version where the behavior was as you desire.Thanks for clarifying!@OP; Also, be aware that some games implement countermeasures to prevent you from sending keystrokes this wayEdit: Use the AutoIT Window Info tool (comes with AutoIT) to get the ControlID/ClassNameNN Edited January 29, 2007 by improbability_paradox Link to comment Share on other sites More sharing options...
stackover Posted January 29, 2007 Author Share Posted January 29, 2007 Thanks Lary and Improbability. PS: Lary any date for 3.2.3 ? Cant wait 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