Jon310 Posted February 9, 2007 Share Posted February 9, 2007 Im going to try and fill this with as much information as possible. I have been reading through the helpfile for days and if its there Im just missing it. (I'm an autoit noob) Im trying to make a script that will control send to a non active window when there are 2 identical windows and one of them is the active window. Let me clarify. Im playing WoW with 2 instances of the game running. My druid on one and my Warrior on the other. I would like to set up Hotkeys that send keystrokes to the 2nd window. Thing is with controlsend it is sending it to the active window as both of them have the same title. Is their any way to differentiate the 2 windows and let autoit only send to the non active window? Here is what I have so far, and the only thing I can think of would be to change the title of the 2nd wow window, but I have no clue how to do that either. expandcollapse popupHotKeySet("{NUMPAD7}", "Targetother") HotKeySet("{NUMPAD8}", "Targetself") HotKeySet("{NUMPAD9}", "Assist") HotKeySet("{NUMPAD4}", "Regrowth") HotKeySet("{NUMPAD5}", "Rejuv") HotKeySet("{NUMPAD6}", "Heal") HotKeySet("{NUMPAD1}", "Mount") HotKeySet("{NUMPAD2}", "Removedebuff") HotKeySet("{NUMPAD3}", "Moonfire") HotKeySet("{NUMPAD0}", "Follow") While 1 Sleep(100) WEnd Func Mount() ControlSend("World", "", "", "1") EndFunc ;==>Mount Func Removedebuff() ControlSend("World", "", "", "2");macro: /castsequence Remove Curse, Cure Poison EndFunc ;==>Removedebuff Func Moonfire() ControlSend("World", "", "", "3") EndFunc ;==>Moonfire Func Regrowth() ControlSend("World", "", "", "4") EndFunc ;==>Regrowth Func Rejuv() ControlSend("World", "", "", "5") EndFunc ;==>Rejuv Func Heal() ControlSend("World", "", "", "6") EndFunc ;==>Heal Func Targetother() ControlSend("World", "", "", "9");macro: /target (name of char) EndFunc ;==>Targetother Func Targetself() ControlSend("World", "", "", "{F1}") EndFunc ;==>Targetself Func Assist() ControlSend("World", "", "", "7");macro: /target (name) /assist, or, /assist (name) EndFunc ;==>Assist Func Follow() ControlSend("World", "", "", "8");macro: /target (name) /follow, or, /follow (name) EndFunc ;==>Follow This is working great, all for the fact that it is sending to whatever window is active. Thanks in advance for any help. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2007 Moderators Share Posted February 9, 2007 There's been a lot of talk lately about 3.2.2.0 and ControlSend being broken. Of course we don't know what version you are using, but ... if you are using 3.2.2.0, try downloading the last 3.1 beta .114 and see if that corrects the issue. You may also consider using Handles of the windows if they are identical in title. 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...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 There's been a lot of talk lately about 3.2.2.0 and ControlSend being broken. Of course we don't know what version you are using, but ... if you are using 3.2.2.0, try downloading the last 3.1 beta .114 and see if that corrects the issue. You may also consider using Handles of the windows if they are identical in title. Thanks for the reply! I am working with 3.2.2.0. Will have to see if that helps, but is controlsend automatically going to send it to the inactive window. I tried working with handles, but im still really fuzzy on how they work. I tried something along the lines of: expandcollapse popupHotKeySet("{NUMPAD7}", "Targetother") HotKeySet("{NUMPAD8}", "Targetself") HotKeySet("{NUMPAD9}", "Assist") HotKeySet("{NUMPAD4}", "Regrowth") HotKeySet("{NUMPAD5}", "Rejuv") HotKeySet("{NUMPAD6}", "Heal") HotKeySet("{NUMPAD1}", "Mount") HotKeySet("{NUMPAD2}", "Removedebuff") HotKeySet("{NUMPAD3}", "Moonfire") HotKeySet("{NUMPAD0}", "Follow") $handle = WinGetHandle("classname=World", "") While 1 Sleep(100) WEnd Func Mount() ControlSend($handle, "", "", "1") EndFunc ;==>Mount Func Removedebuff() ControlSend($handle, "", "", "2");macro: /castsequence Remove Curse, Cure Poison EndFunc ;==>Removedebuff Func Moonfire() ControlSend($handle, "", "", "3") EndFunc ;==>Moonfire Func Regrowth() ControlSend($handle, "", "", "4") EndFunc ;==>Regrowth Func Rejuv() ControlSend($handle, "", "", "5") EndFunc ;==>Rejuv Func Heal() ControlSend($handle, "", "", "6") EndFunc ;==>Heal Func Targetother() ControlSend($handle, "", "", "9");macro: /target (name of char) EndFunc ;==>Targetother Func Targetself() ControlSend($handle, "", "", "{F1}") EndFunc ;==>Targetself Func Assist() ControlSend($handle, "", "", "7");macro: /target (name) /assist, or, /assist (name) EndFunc ;==>Assist Func Follow() ControlSend($handle, "", "", "8");macro: /target (name) /follow, or, /follow (name) EndFunc ;==>Follow When I tried this script it still works but will send it to the active window still. Again, I'm very fuzzy on how handles work. I have an autoit program that would change the title of the Diablo window that is opened, but I cant figure out how to convert it for WoW. Is there any way to run a game through autoit and change the title? Link to comment Share on other sites More sharing options...
Shevilie Posted February 9, 2007 Share Posted February 9, 2007 This is a little smish smash to get the two handles... activate a wow window and press 1 or 2 and you should be able to guess the rest HotKeySet("1", "SetWorld1") HotKeySet("2", "SetWorld2") AutoItSetOption("WinTitleMatchMode", 4) Func SetWorld1 Global W1 = WinGetHandle("active") EndFunc Func SetWorld2 Global W2 = WinGetHandle("active") EndFunc Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2007 Moderators Share Posted February 9, 2007 Are you trying to send it to the inactive window only, both, or only active? 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...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 Are you trying to send it to the inactive window only, both, or only active?Im trying to send it to the inactive window only.This is a little smish smash to get the two handles... activate a wow window and press 1 or 2 and you should be able to guess the restI actually dont get what this does. (Sorry for being such a noob!) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2007 Moderators Share Posted February 9, 2007 I don't usually help on game bots... but you did put forth an effort, you may still need to revert to the older beta for controlsend thoughexpandcollapse popupHotKeySet("{NUMPAD7}", "Targetother") HotKeySet("{NUMPAD8}", "Targetself") HotKeySet("{NUMPAD9}", "Assist") HotKeySet("{NUMPAD4}", "Regrowth") HotKeySet("{NUMPAD5}", "Rejuv") HotKeySet("{NUMPAD6}", "Heal") HotKeySet("{NUMPAD1}", "Mount") HotKeySet("{NUMPAD2}", "Removedebuff") HotKeySet("{NUMPAD3}", "Moonfire") HotKeySet("{NUMPAD0}", "Follow") Global $aHandle = _WOWGetHandles();Get an array of the handles that match the classname= While 1 Sleep(100) WEnd Func Mount() _WOWCtrlSnd($handle, "1");Since we aren't using any text or control id's, we'll just make a function to conditionally check for active window EndFunc ;==>Mount Func Removedebuff() _WOWCtrlSnd($handle, "2");macro: /castsequence Remove Curse, Cure Poison EndFunc ;==>Removedebuff Func Moonfire() _WOWCtrlSnd($handle, "3") EndFunc ;==>Moonfire Func Regrowth() _WOWCtrlSnd($handle, "4") EndFunc ;==>Regrowth Func Rejuv() _WOWCtrlSnd($handle, "5") EndFunc ;==>Rejuv Func Heal() _WOWCtrlSnd($handle, "6") EndFunc ;==>Heal Func Targetother() _WOWCtrlSnd($handle, "9");macro: /target (name of char) EndFunc ;==>Targetother Func Targetself() _WOWCtrlSnd($handle, "{F1}") EndFunc ;==>Targetself Func Assist() _WOWCtrlSnd($handle, "7");macro: /target (name) /assist, or, /assist (name) EndFunc ;==>Assist Func Follow() _WOWCtrlSnd($handle, "8");macro: /target (name) /follow, or, /follow (name) EndFunc ;==>Follow Func _WOWCtrlSnd($aHwnd, $sText);Pass the array of Window handles, and the text to send, check if window is active, if not send For $iCC = 1 To UBound($aHwnd) - 1 If WinActive(HWnd($aHwnd[$iCC])) = 0 Then Return ControlSend(HWnd($aHwnd), '', '', $sText) Next Return SetError(1, 0, 0) EndFunc Func _WOWGetHandles($sClass = 'World') $OPTWTMM = Opt('WinTitleMatchMode', 4) Local $aWL = WinList('classname=' & $sClass), $aWins[1], $iAdd Opt('WinTitleMatchMode', $OPTWTMM) For $iCC = 1 To UBound($aWL) - 1 If $aWL[$iCC][0] <> '' Then $iAdd += 1 ReDim $aWins[$iAdd + 1] $aWins[$iAdd] = $aWL[$iCC][1] EndIf Next Return $aWins EndFunc 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...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 I don't usually help on game bots... but you did put forth an effort, you may still need to revert to the older beta for controlsend thoughThanks, I would have never got this myself. It took me like 10 mins looking this over to even understand what was doing what.You are my hero!!! Link to comment Share on other sites More sharing options...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 Hey sorry to bother again. When i run the script and press a hotkey i get this error: _WOWCtrlSnd($handle, "7") _WOWCtrlSnd( ERROR Error: Variable used without being declared. Any clue as to what I'm doing wrong? Link to comment Share on other sites More sharing options...
/dev/null Posted February 9, 2007 Share Posted February 9, 2007 Hey sorry to bother again. When i run the script and press a hotkey i get this error: _WOWCtrlSnd($handle, "7") _WOWCtrlSnd( ERROR Error: Variable used without being declared. Any clue as to what I'm doing wrong? Replace: Global $aHandle = ...oÝ÷ Û«¢+Ù±½°ÀÌØí¡¹±ô¸¸¸ __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 Replace: Global $aHandle = ...oÝ÷ Û«¢+Ù±½°ÀÌØí¡¹±ô¸¸¸ Thanks Again!! Link to comment Share on other sites More sharing options...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 (edited) Started this up with the game running on my lunch break to test it real quick. Got this error. Error does not happern when the game is not running. If WinActive(HWnd($aHwnd[$iCC])) = 0 Then Return ControlSend(Hwnd($aHwnd), ", ", $sText) If WinActive( Error Error: Unknown function name. Any ideas as to why I'm getting this error? Edited February 9, 2007 by Jon310 Link to comment Share on other sites More sharing options...
BALA Posted February 9, 2007 Share Posted February 9, 2007 (edited) Started this up with the game running on my lunch break to test it real quick. Got this error. Error does not happern when the game is not running. If WinActive(HWnd($aHwnd[$iCC])) = 0 Then Return ControlSend(Hwnd($aHwnd), ", ", $sText) If WinActive( Error Error: Unknown function name. Any ideas as to why I'm getting this error? Somehow the function name is unknown there, hence the: Unknown function name. EDIT: I'm not sure, but I think it is the "Hwnd" Edited February 9, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 Somehow the function name is unknown there, hence the: EDIT: I'm not sure, but I think it is the "Hwnd" Hmm.. I pretty much dont understand that line at all. Anyone else know why im getting the error? Link to comment Share on other sites More sharing options...
Helge Posted February 9, 2007 Share Posted February 9, 2007 Hmm.. I pretty much dont understand that line at all. Anyone else know why im getting the error?Hmm...what version are you running ? Newest is 3.2.2.0. MsgBox(64, "", @AutoItVersion) Link to comment Share on other sites More sharing options...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 (edited) Hmm...what version are you running ? Newest is 3.2.2.0. MsgBox(64, "", @AutoItVersion) I was running the latest, but just installed the beta 3.2.1.14. Edit: Same error on either. Edited February 9, 2007 by Jon310 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2007 Moderators Share Posted February 9, 2007 (edited) My mistake on not replacing your handles.... the error is probably because you are more than likely starting the script before you start the game.expandcollapse popupHotKeySet("{NUMPAD7}", "Targetother") HotKeySet("{NUMPAD8}", "Targetself") HotKeySet("{NUMPAD9}", "Assist") HotKeySet("{NUMPAD4}", "Regrowth") HotKeySet("{NUMPAD5}", "Rejuv") HotKeySet("{NUMPAD6}", "Heal") HotKeySet("{NUMPAD1}", "Mount") HotKeySet("{NUMPAD2}", "Removedebuff") HotKeySet("{NUMPAD3}", "Moonfire") HotKeySet("{NUMPAD0}", "Follow") Global $aHandle While 1 Sleep(2000) $aHandle = _WOWGetHandles();Get an array of the handles that match the classname= every 2 seconds WEnd Func Mount() _WOWCtrlSnd($aHandle, "1");Since we aren't using any text or control id's, we'll just make a function to conditionally check for active window EndFunc ;==>Mount Func Removedebuff() _WOWCtrlSnd($aHandle, "2");macro: /castsequence Remove Curse, Cure Poison EndFunc ;==>Removedebuff Func Moonfire() _WOWCtrlSnd($aHandle, "3") EndFunc ;==>Moonfire Func Regrowth() _WOWCtrlSnd($aHandle, "4") EndFunc ;==>Regrowth Func Rejuv() _WOWCtrlSnd($aHandle, "5") EndFunc ;==>Rejuv Func Heal() _WOWCtrlSnd($aHandle, "6") EndFunc ;==>Heal Func Targetother() _WOWCtrlSnd($aHandle, "9");macro: /target (name of char) EndFunc ;==>Targetother Func Targetself() _WOWCtrlSnd($aHandle, "{F1}") EndFunc ;==>Targetself Func Assist() _WOWCtrlSnd($aHandle, "7");macro: /target (name) /assist, or, /assist (name) EndFunc ;==>Assist Func Follow() _WOWCtrlSnd($aHandle, "8");macro: /target (name) /follow, or, /follow (name) EndFunc ;==>Follow Func _WOWCtrlSnd($aHwnd, $sText);Pass the array of Window handles, and the text to send, check if window is active, if not send For $iCC = 1 To UBound($aHwnd) - 1 If WinExists(HWnd($aHwnd[$iCC])) Then If WinActive(HWnd($aHwnd[$iCC])) = 0 Then Return ControlSend(HWnd($aHwnd), '', '', $sText) Else MsgBox(16, 'Error', 'You started the script before the game more than likely.') EndIf Next Return SetError(1, 0, 0) EndFunc Func _WOWGetHandles($sClass = 'World') $OPTWTMM = Opt('WinTitleMatchMode', 4) Local $aWL = WinList('classname=' & $sClass), $aWins[1], $iAdd Opt('WinTitleMatchMode', $OPTWTMM) For $iCC = 1 To UBound($aWL) - 1 If $aWL[$iCC][0] <> '' Then $iAdd += 1 ReDim $aWins[$iAdd + 1] $aWins[$iAdd] = $aWL[$iCC][1] EndIf Next Return $aWins EndFunc Edited February 9, 2007 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...
Jon310 Posted February 9, 2007 Author Share Posted February 9, 2007 My mistake on not replacing your handles.... the error is probably because you are more than likely starting the script before you start the gameThanks for the help. I really appreciate it. 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