Jump to content

Recommended Posts

Posted

#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.
  • Moderators
Posted

knova,

WinActivate("World of Warcraft")

Things have changed since you got that code - you obviously missed this on the way in. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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.

Posted

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.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...