Xab Posted September 13, 2006 Share Posted September 13, 2006 Ok, after searching around the forums and doing a few experiments I am stumped.I am trying to send a single keystroke to the online game EverQuest, for the purposes of skilling up a new character's magic skills (Requires casting a spell over and over and over...)I can do this fine if EQ remains the active window...Works Fine:WinWaitActive("EverQuest") Send("{NUMPADADD}")However, i want to do other stuff like browse the web or watch tv shows i have saved while doing this, so i would love to send this to the window while it is not active or even minimized. I have tried using ControlSend in various ways, but it just does not seem to work at all:Does NOT Work:;attempt #1 $return = ControlSend("EverQuest", "", "", "hello") ;always returns 1 ;attempt #2 $eqwin = WinGetHandle("EverQuest") $return = ControlSend($eqwin, "", "", "{NUMPADADD}") ;always returns 1 $return = ControlSend(hwnd($eqwin), "", "", "{NUMPADADD}") ;always returns 1Using the "inspector" tool there is no "Control ID" for EQ:>>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: EverQuest Class: _EverQuestwndclass Size: X: 31 Y: 78 W: 1286 H: 1056 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 743 Y: 411 Cursor ID: 0 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0x1A2524 Dec: 1713444 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: Control ID: ClassNameNN: Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< >>>>>>>>>>> Hidden Window Text <<<<<<<<<<<Any suggestions? Link to comment Share on other sites More sharing options...
AceLoc Posted September 13, 2006 Share Posted September 13, 2006 (edited) Ok, after searching around the forums and doing a few experiments I am stumped. I am trying to send a single keystroke to the online game EverQuest, for the purposes of skilling up a new character's magic skills (Requires casting a spell over and over and over...) I can do this fine if EQ remains the active window... Works Fine: WinWaitActive("EverQuest") Send("{NUMPADADD}") However, i want to do other stuff like browse the web or watch tv shows i have saved while doing this, so i would love to send this to the window while it is not active or even minimized. I have tried using ControlSend in various ways, but it just does not seem to work at all: Does NOT Work: ;attempt #1 $return = ControlSend("EverQuest", "", "", "hello");always returns 1 ;attempt #2 $eqwin = WinGetHandle("EverQuest") $return = ControlSend($eqwin, "", "", "{NUMPADADD}");always returns 1 $return = ControlSend(hwnd($eqwin), "", "", "{NUMPADADD}");always returns 1 Using the "inspector" tool there is no "Control ID" for EQ: >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: EverQuest Class: _EverQuestwndclass Size: X: 31 Y: 78 W: 1286 H: 1056 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 743 Y: 411 Cursor ID: 0 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0x1A2524 Dec: 1713444 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: Control ID: ClassNameNN: Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< Any suggestions? try: $oZomg = "EverQuest" ;attempt #1 $return = ControlSend($oZomg, "", "", "hello");always returns 1 ;attempt #2 $eqwin = WinGetHandle("$oZomg") $return = ControlSend($eqwin, "", "", "{NUMPADADD}");always returns 1 $return = ControlSend(hwnd($eqwin), "", "", "{NUMPADADD}");always returns 1 tell me if it works or if it aint *-) Edited September 13, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
AceLoc Posted September 13, 2006 Share Posted September 13, 2006 (edited) if that dont works try this: AutoItSetOption("WinTitleMatchMode", 4);the param(4) can also be 2 or whatever. ;Gets handle over the EverQuest window $handle = WinGetHandle("classname=_EverQuestwndclass", "") If @error Then MsgBox(4096, "Error", "Could not find correct window.") exit Else $i = 0 Do ;MsgBox(4096, "success", "The window handle is " & $handle) ;Send some text directly to this window's edit control ;ControlClick("handle=" & $handle, "", "", "left") Opt("SendKeyDelay", 35);you could remove this. ControlSend("handle=" & $handle, "", "", "Whatever-you-wanna type") ControlSend("handle=" & $handle, "", "", "Whatever-you-wanna type") ControlSend("handle=" & $handle, "", "", "Whatever-you-wanna type") ControlSend("handle=" & $handle, "", "", "Whatever-you-wanna type") $i = $i + 1 Until $i = 1;you can change the(1) to how much times you want to repeat the part. EndIf that should work for sure *-) if you wanna add more controlsend options just add a line -Ace Loc Edited September 13, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
Xab Posted September 13, 2006 Author Share Posted September 13, 2006 Unfortunatly neither of these solutions work. The second one which specifies the handle errors out saying that it is obsolete and to give the handle directly. I specified the $handle variable directly instead of using "handle=" & $handle, which removed the error, but it still does not send the specified input or rather EQ does not act upon it. Im thinking it might have something to do with the fact that EQ has no controls at all. Its just a direct x window upon which the game is drawn. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 13, 2006 Moderators Share Posted September 13, 2006 (edited) Where did you come up with "handle="?I've seen that a few times from others, but I don't see it in the documentation... something I've missed?http://www.autoitscript.com/autoit3/docs/i...owsadvanced.htm Edited September 13, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
jpm Posted September 13, 2006 Share Posted September 13, 2006 Where did you come up with "handle="?I've seen that a few times from others, but I don't see it in the documentation... something I've missed?http://www.autoitscript.com/autoit3/docs/i...owsadvanced.htmThat's was an old syntax. I don't remember when we change that. but I was a very long time ago. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 13, 2006 Moderators Share Posted September 13, 2006 That's was an old syntax. I don't remember when we change that. but I was a very long time ago.Thanks, but does that mean the documenation is somewhere, because I've actually seen it from ALOT of noobs. I saw that Jdeb corrected one of them, but it's easy to see above that it's in use from someone that hasn't been using AutoIt that long (Maybe in the v2 syntax?... I've never seen any of the files from them myself to clarify). 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. 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