knova Posted February 26, 2011 Share Posted February 26, 2011 expandcollapse popup#include <misc.au3> $dll = DllOpen("user32.dll") $x = 1 $key="05" $count = 0 ;MsgBox(0, 0, $count) ;HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc WinActivate("World of Warcraft") $hwnd = WinGetHandle("[ACTIVE]") Global $Button2 = 0x00020040; 0x20 Global $Button2Down = 0x20B ;x1Button Left side of mouse - Back Global $Button2Up = 0x20C Global $Button = 0x00010020 ;;x2Button right side of mouse - forward Global $ButtonDown = 0x20B Global $ButtonUp = 0x20C $X1 = "" $Y = "" While 1 HotKeySet(@HotKeyPressed, "dummy") If $X1 = "" Or $Y = "" Then $MouseCoord = MouseGetPos() $X1 = $MouseCoord[0] $Y = $MouseCoord[1] EndIf While _IsPressed("06", $dll) Sleep(100) DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $Button2Down, "int", $Button2, "long", _MakeLong($X1, $Y)) DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $Button2Up, "int", $Button2, "long", _MakeLong($X1, $Y)) WEnd While _IsPressed("05", $dll) Sleep(100) DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X1, $Y)) DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X1, $Y)) WEnd While _IsPressed("C0", $dll) Sleep(100) Send("`") WEnd While _IsPressed("31", $dll) Sleep(100) Send("1") WEnd While _IsPressed("32", $dll) Sleep(100) Send("2") WEnd While _IsPressed("33", $dll) Sleep(100) Send("3") WEnd While _IsPressed("34", $dll) Sleep(100) Send("4") WEnd While _IsPressed("35", $dll) Sleep(100) Send("5") WEnd WEnd Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc ;==>_MakeLong Func dummy() EndFunc DllClose($dll) The majority of this code was found on some forum a while back, and I modified it to work for me. After a fresh install of Windows, it isn't working anymore. I am attempting at a more elegant re-write. Some problems with the old one were "sticky keys" i.e. if I was holding "Q" to strafe while I pressed a button that is set to repeat, sometimes Q would stick until I hit it again. I have a simpler way to find the keypress in If _IsPressed(Hex(6)) Then ;or 5 but I can't figure out a way to make sure its the only button that is pressed (no sticky's) and how to actually send the keypress back. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 26, 2011 Moderators Share Posted February 26, 2011 knova,WinActivate("World of Warcraft")Things have changed since you got that code - you obviously missed this on the way in. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
knova Posted February 26, 2011 Author Share Posted February 26, 2011 Oh, indeed I did. Does this technically count as automation? I am required to sit there and press a button at the appropriate times and it simply repeats it for me. Did not intend to break any rules, sorry about that. Link to comment Share on other sites More sharing options...
Rogue5099 Posted February 26, 2011 Share Posted February 26, 2011 Does this technically count as automation? I am required to sit there and press a button at the appropriate times and it simply repeats it for me."Automation Defined: Automation is the use of control systems and information technologies to reduce the need for human work."You press a button then the script Automatically repeats it for you, hince automation.This is not to come off as rude, just enlightening. My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Recommended Posts