Code:
;This code block captures the mouse location and saves it to an ini file.
func setcoords()
MsgBox(64,"Configuration", "AutoBuff will configure your weapon positions so open WoW and your Character Window (C)")
MsgBox(0,"Main-hand", "Place your mouse over your mainhand weapon in your character window then press Return")
$main = MouseGetPos()
MsgBox(0,"Off-hand", "Now do the same for your Off-hand weapon")
$off = MouseGetPos()
IniWrite("autobuff-config.ini", "positions", "Main-hand X", $main[0])
IniWrite("autobuff-config.ini", "positions", "Main-hand Y", $main[1])
IniWrite("autobuff-config.ini", "positions", "Off-hand X", $off[0])
IniWrite("autobuff-config.ini", "positions", "Off-hand Y", $off[1])
EndFunc
;This code block checks if the ini files exists. if not runs first codeblock.
If Not FileExists("autobuff-config.ini") Then
setcoords()
EndIf
;This block Creates the GUI, which is the "Graphical user interface"
#include <GUIConstants.au3>
GUICreate("AutoBuff", 220, 160)
GUISetState (@SW_SHOW)
;Some Variables used in the script.
$mainx = IniRead("autobuff-config.ini", "positions", "Main-hand X", "")
$mainy = IniRead("autobuff-config.ini", "positions", "Main-hand Y", "")
$offx = IniRead("autobuff-config.ini", "positions", "Off-hand X", "")
$offy = IniRead("autobuff-config.ini", "positions", "Off-hand Y", "")
$mainkey = IniRead("autobuff-config.ini", "keys", "mainhand", "")
$offkey = IniRead("autobuff-config.ini", "keys", "offhand", "")
;This is the script input and labels.
$mainhand = GUICtrlCreateInput($mainkey,130,7,40)
GUICtrlCreateLabel("Poison key (Mainhand)",10,10)
$offhand = GUICtrlCreateInput($offkey,130,30,40)
GUICtrlCreateLabel("Poison key (Off-hand)",10,33)
$help = GUICtrlCreateButton("Help?", 175, 17)
GUICtrlCreateLabel("Main-hand positions: ",10,70)
$gotomain = GUICtrlCreateButton("x="&$mainx&" y="&$mainy,120,65,80,20)
GUICtrlCreateLabel("Off-hand positions: ",10,90)
$gotooff = GUICtrlCreateButton("x="&$offx&" y="&$offy,120,85,80,20)
$reset = GUICtrlCreateButton("Reset coords?",120,105,80,20)
$run = GUICtrlCreateButton("Run Script",25,130,80,20)
$close = GUICtrlCreateButton("Close Script",110,130,80,20)
;This is the important bit :P this is what happens when you press "run script"
func runscript()
ControlFocus("World of Warcraft","","")
sleep(1000)
send("c")
sleep(500)
send(GUICtrlRead($mainhand))
sleep(300)
MouseClick("left",$mainx,$mainy)
sleep(3500)
send(GUICtrlRead($offhand))
sleep(300)
MouseClick("left",$offx,$offy)
sleep(300)
send("c")
EndFunc
;This part processes all the input from the GUI.
While 1
$msg = GUIGetMsg()
Select
Case $msg = $close
WinClose("AutoBuff")
iniwrite("autobuff-config.ini","keys","mainhand", GUICtrlRead($mainhand))
iniwrite("autobuff-config.ini","keys","offhand", GUICtrlRead($offhand))
Case $msg = $reset
$delini = msgbox(4,"Confirm","Are you sure?")
if $delini = 6 then
setcoords()
MsgBox(64,"Done","Config file has been reset, now please restart AutoBuff")
EndIf
Case $msg = $run
iniwrite("autobuff-config.ini","keys","mainhand", GUICtrlRead($mainhand))
iniwrite("autobuff-config.ini","keys","offhand", GUICtrlRead($offhand))
runscript()
Case $msg = $help
msgbox(0,"Help","The Poision keys are where abouts on your WoW interface your poisions are located")
Case $msg = $gotooff
MouseMove($offx,$offy)
Case $msg = $gotomain
MouseMove($mainx,$mainy)
EndSelect
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
im too lazy to write a description about it right now so i'll let you figure it out :P