Nahrix Posted August 27, 2009 Posted August 27, 2009 (edited) I am trying to write a simple bot for a game to execute a simple repetitive task while I browse the web. I want to send a single keystroke to the minimized, inactive window. After much googling on the topic, I couldn't find a single case where someone had successfully accomplished this task. Here is the code snippet of my attempt to send a single spacebar keystroke to the inactive window: #Include <SendMessage.au3> _SendMessage(WinGetHandle("GameWindowTitle"), 0x100, 0x20, 1) _SendMessage(WinGetHandle("GameWindowTitle"), 0x101, 0x20, 1) Thank you very much in advance for any advice you can offer. (If it helps, I'm running Vista 64-bit) Edited August 27, 2009 by Nahrix
somdcomputerguy Posted August 27, 2009 Posted August 27, 2009 Try ControlSend. I use that to send to minimized, unfocused windows.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Nahrix Posted August 27, 2009 Author Posted August 27, 2009 Try ControlSend. I use that to send to minimized, unfocused windows..I am sending the keystroke to a game window that has no obtainable control to send it (ie the autoit info tool, or any other tool provides blank information in the control section). The only way this seems possible is to use _SendMessage or some other method.
WolfWorld Posted August 28, 2009 Posted August 28, 2009 Is it protected by gameguard or xtrap. Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets!
Moderators SmOke_N Posted August 29, 2009 Moderators Posted August 29, 2009 Keys are generally sent with PostMessage because you're not waiting on a reply from the window. Putting that aside for a moment, if you can't do: ControlSend(handle to window, "", "", "{SPACE}") ( leaving the control id/ classnamenn param blank ) and it work, chances are, that it's not going to work anyway.You could also test Send("{SPACE}") while the window you want to interact with is active to see if that works:WinWaitActive("Window Name or handle") Sleep(250) Send({SPACE})Other than that, anonymity of the program you wish to interact with will not help you much. You're making people take guesses that just waste their/our time. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Nahrix Posted August 29, 2009 Author Posted August 29, 2009 (edited) I'm sorry, I don't want to waste your time. The game is called "Darkfall Online" PostMessage doesn't work either, but Send to the activated window works perfectly fine. Edit: Whoops, I tried PostMessage with another program which didn't work. AutoIt doesn't appear to have _PostMessage in the Include directory. Edited August 29, 2009 by Nahrix
LarryDalooza Posted August 31, 2009 Posted August 31, 2009 ControlSend takes a HANDLE so try using the handle to the window... $hwnd = WinGetHandle("the window") ControlSend("","",$hwnd,"test") Lar. AutoIt has helped make me wealthy
Nahrix Posted August 31, 2009 Author Posted August 31, 2009 Neither ControlSend("", "", $hwnd, "{SPACE}") nor ControlSend($hwnd, "", $hwnd, "{SPACE}") are working.
Bert Posted August 31, 2009 Posted August 31, 2009 Can you get the handle of the window???? Every window has a handle. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Nahrix Posted August 31, 2009 Author Posted August 31, 2009 I can get the handle of the window using the au3info tool, but attempting to manually use the handle, like so: _SendMessage("0x0000000000150770", 0x100, 0x20, 1) _SendMessage("0x0000000000150770", 0x101, 0x20, 1) or doing the same with the ControlSend function, does not work.
trancexx Posted August 31, 2009 Posted August 31, 2009 I can get the handle of the window using the au3info tool, but attempting to manually use the handle, like so:_SendMessage("0x0000000000150770", 0x100, 0x20, 1)_SendMessage("0x0000000000150770", 0x101, 0x20, 1)or doing the same with the ControlSend function, does not work.Remove quotations. ♡♡♡ . eMyvnE
Bert Posted August 31, 2009 Posted August 31, 2009 post ALL the info from the tool. Screen shot the thing so we can see it The Vollatran project My blog: http://www.vollysinterestingshit.com/
Nahrix Posted August 31, 2009 Author Posted August 31, 2009 trancexx: Removing the quotations causes an error, "Unable to parse line"volley:
trancexx Posted September 1, 2009 Posted September 1, 2009 trancexx: Removing the quotations causes an error, "Unable to parse line"Remove leading zeros.Or use HWnd() function. ♡♡♡ . eMyvnE
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