JamieF Posted January 20, 2007 Share Posted January 20, 2007 basically I am trying to send mouse down and up and key down commands to multiple windows I do not know if this is technically possible or not but the windows i am tying to send the commands to do not have control ids as it is a game. but controlclick seems to be the only way to send a click to a window. at first I thought that by making the controlid blank "" that it would just send to window no matter what. Am I false in this guess? I was also thinking of making the mousedown function into a varible and that variable into a string that could be put into the string section of the controlsend am I also right in that assumption? assuming that you cant make a mousedown into a string variable i decided to depend upon loop statements instead and use mousedelaydown set at 1800000 miliseconds would do the trick how about I past what ive got so far and hopefully you guys can correct my noobness as this is really my first time programming other then html expandcollapse popup;======================================================================== ; Auto Cast and Hammerdin Auto Cast by Jamie Foster ; jamief@ktonix.com ; January 19 2007 ; ; ; How to use - Instructions ; This script is based on d2loader and running 3 of them at the same time ; So how to set up is first in all 3 loaders bind standstill to z for the hammerdin attack ; each window of d2 loader should be called DWIN-1 DWIN-2 DWIN-3 ; you numpad gets taken over for the execution of the scripts ; numpad multiply ( * ) quits the script ; numpad minus ( - ) stops the casting ; numpad plus ( + ) starts the casting ; numpad numbers 1-6 are use to set which window to target with which script ; numpad 1,2,3 are used for right click script on corresponding windows 1,2,3 ; numpad 4,5,6 are used for hammerdin click script on corresponding windows 1,2,3 in this case 4=1 , 5=2 , 6=3 ; ; ; ;============================ ;============script running check $g_szVersion = "Jamie's autocast script" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) ;=========================================================== ; Keeps the Script running in the background, until you exit While 1 Sleep (1000) WEnd ;========================================== ;==== chosing diablo 2 window to activate HotKeySet ("{NUMPAD1}", "window1");Window1 HotKeySet ("{NUMPAD2}", "window2");Window2 HotKeySet ("{NUMPAD3}", "window3");Window3 HotKeySet ("{NUMPAD4}", "window1h");Window1 HotKeySet ("{NUMPAD5}", "window2h");Window2 HotKeySet ("{NUMPAD6}", "window3h");Window3 HotKeySet ("{NUMPADMULT}", "QUITALL");Hotkey to exit the script ;========================================= ;==================== Window 1 Function Func Window1 () HotKeySet ("{NUMPADADD}", "rightclickw1");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "rightclickw1q");Hotkey to exit the script ToolTip("Diablo window 1 Right Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc Func Window2 () HotKeySet ("{NUMPADADD}", "rightclickw2");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "rightclickw2q");Hotkey to exit the script ToolTip("Diablo window 2 Right Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc Func Window3 () HotKeySet ("{NUMPADADD}", "rightclickw3");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "rightclickw3q");Hotkey to exit the script ToolTip("Diablo window 3 Right Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc Func Window1h () HotKeySet ("{NUMPADADD}", "hammerclickw1");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "hammerclickw1q");Hotkey to exit the script ToolTip("Diablo window 1 Hammerdin Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc Func Window2h () HotKeySet ("{NUMPADADD}", "hammerclickw2");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "hammerclickw2q");Hotkey to exit the script ToolTip("Diablo window 2 Hammerdin Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc Func Window3h () HotKeySet ("{NUMPADADD}", "hammerclickw2");Hotkey to activate the script uses: {SHIFT}{ALT}{CTRL}n HotKeySet ("{NUMPADSUB}", "hammerclickw2q");Hotkey to exit the script ToolTip("Diablo window 3 Hammerdin Click Script Hotkeys loaded", 0, 0,) Sleep (2000) EndFunc ;==================Functions Called Func rightclickw1 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) Global $minus1 = 0 Do ControlClick ( "DWIN-1", "", "", right, 5 ) Until Global $minus1 = 1 EndFunc Func rightclickw1q () Global $minus1 = $minus1 +1 local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc Func rightclickw2 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) Global $minus2 = 0 Do ControlClick ( "DWIN-2", "", "", right, 5 ) Until Global $minus2 = 1 EndFunc Func rightclickw2q () Global $minus2 = $minus2 +1 local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc Func rightclickw3 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) Global $minus3 = 0 Do ControlClick ( "DWIN-3", "", "", right, 5 ) Until Global $minus3 = 1 EndFunc Func rightclickw3q () Global $minus3 = $minus3 +1 local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc Func hammerclickw1 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) ControlSend("DWIN-1", "", "", "{z down}", 0) Global $minus4 = 0 Do ControlClick ( "DWIN-1", "", "", left, 5 ) Until Global $minus4 = 1 EndFunc Func hammerclickw1q () Global $minus4 = $minus4 +1 ControlSend("DWIN-1", "", "", "{z up}", 0) local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc Func hammerclickw2 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) ControlSend("DWIN-2", "", "", "{z down}", 0) Global $minus5 = 0 Do ControlClick ( "DWIN-2", "", "", left, 5 ) Until Global $minus5 = 1 EndFunc Func hammerclickw2q () Global $minus5 = $minus5 +1 ControlSend("DWIN-2", "", "", "{z up}", 0) local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc Func hammerclickw3 () local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 700000) ControlSend("DWIN-3", "", "", "{z down}", 0) Global $minus6 = 0 Do ControlClick ( "DWIN-3", "", "", left, 5 ) Until Global $minus6 = 1 EndFunc Func hammerclickw3q () Global $minus6 = $minus6 +1 ControlSend("DWIN-3", "", "", "{z up}", 0) local Opt("MouseClickDelay", 10) local Opt("MouseClickDownDelay", 10) EndFunc ;====================== ; Exit Program Func Quitall () Exit EndFunc ;====================== is there an easier way to do this , tell me im crazy Link to comment Share on other sites More sharing options...
JamieF Posted January 20, 2007 Author Share Posted January 20, 2007 btw guys this is my first time coding and I tried following the online documentation to complete it but having some problems Link to comment Share on other sites More sharing options...
Uten Posted January 20, 2007 Share Posted January 20, 2007 I dont have the helpfile available so look up the syntax on MouseClick(...) Use Send(...) To send a string. Look at the Win* functions to switch the receiving application. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
JamieF Posted January 20, 2007 Author Share Posted January 20, 2007 I wanted to send the functions to the window thats not active, how would I end up doing that? Link to comment Share on other sites More sharing options...
JamieF Posted January 20, 2007 Author Share Posted January 20, 2007 (edited) I guess I could play with window focus and defocus , but I am still wondering the possibility of sending clicks to a programs without them being active Edited January 20, 2007 by JamieF Link to comment Share on other sites More sharing options...
JamieF Posted January 21, 2007 Author Share Posted January 21, 2007 anyone else know? Link to comment Share on other sites More sharing options...
Bert Posted January 21, 2007 Share Posted January 21, 2007 ok, what you need to do is use controlsend to the control you want to interact with. To get the id of the control, use the window info tool that is included in the AutoIt Suite. Once you know the id, it should be very easy to send what you want. Most games will accept keyboard input as well as mouse input. If you can tab to the control, and then use the space bar to "click" it, then it should be easy. Sometimes you may need to use "enter" instead. The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JamieF Posted January 22, 2007 Author Share Posted January 22, 2007 ok, what you need to do is use controlsend to the control you want to interact with. To get the id of the control, use the window info tool that is included in the AutoIt Suite. Once you know the id, it should be very easy to send what you want. Most games will accept keyboard input as well as mouse input. If you can tab to the control, and then use the space bar to "click" it, then it should be easy. Sometimes you may need to use "enter" instead.I have already tried to find out the control id with the tool provided in the autoit suitewhat it comes up with is nothing for a control id. its completely blank I will give it another try but from what i have already tried is every "control" or what should be a control isnt . Link to comment Share on other sites More sharing options...
JamieF Posted January 22, 2007 Author Share Posted January 22, 2007 (edited) what I mean by my top post is that under the control under mouse section of the tool has no values for anything , no size control id or class name Edited January 22, 2007 by JamieF Link to comment Share on other sites More sharing options...
Uten Posted January 22, 2007 Share Posted January 22, 2007 It's a game right.I suggest you read the entire thread once more. Note down the tips you already have gotten and use the search link. Even searching for diablo in the forum would probably highlight your problem area. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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