Mouse Tool

Posts 19 of 9 · Page 1 of 1
Mouse Tool
Here is a little mousegetter tool I made in autoit a long time ago, decided to share it since I don't use it anymore and it's going to waste.



Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MouseGetter -Nunya", 215, 144, 192, 124)
$StartB = GUICtrlCreateButton("Start", 5, 5, 200, 24)
$Label1 = GUICtrlCreateLabel("Left Clicks Recorded - Right Click to copy all info to Clipboard and stop recording. Only In-Game Clicks are Recorded." &@LF&@LF& "HOME, END, DELETE, PAGEDOWN - will move the mouse 1 pixel. INSERT Will copy all info to Clipboard", 5, 33, 200, 100, $SS_CENTER)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

WinSetOnTop("MouseGetter -Nunya", "", 1)
Global $wWindow = "[Class:Valve001]" ; Name class of $wWindow
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 1)
HotKeySet("{HOME}", "MovUp")
HotKeySet("{END}", "MovDn")
HotKeySet("{Delete}", "MovLt")
HotKeySet("{PGDN}", "MovRT")


While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $StartB
			Start()		
	EndSwitch
WEnd

Func Start()
WinActivate($wWindow)
$dll = DllOpen("user32.dll")	
Global $numClicks = 0

While 1
sleep(10)
	While 1
	sleep(10)
		If WinActive($wWindow,"") and _IsPressed("01", $dll) Then
			While _IsPressed("01", $dll)
				sleep(1)
			Wend
			$numClicks += 1
			ExitLoop 1
		EndIf
		If _IsPressed("02", $dll) Then
			clipput($data)
			ExitLoop 2
		EndIf
		If _IsPressed("2D", $dll) Then
			clipput($data)
		EndIf		
		If WinActive($wWindow,"") then
			$Pos = MouseGetPos()
			$col = PixelGetColor ($Pos[0], $Pos[1])
			$colHex = stringreplace(hex($col),2,"x")
			tooltip("X-" & $Pos[0] & " / " & "Y-" & $Pos[1] & " / " & "Color-" & $colHex & " / Clicks " & $numclicks)
			global $data = "X-" & $Pos[0] & " / Y-" & $Pos[1] & " / Color-" & $colHex & " / Clicks " & $numclicks
		EndIf
		If GuiGetMsg() = $GUI_EVENT_CLOSE Then
			Exit
		EndIf
	Wend
WEnd
DllClose($dll)
EndFunc

Func MovUp()
	$Pos = MouseGetPos()
	mousemove($Pos[0], $Pos[1] - 1)
EndFunc

Func MovDn()
	$Pos = MouseGetPos()
	mousemove($Pos[0], $Pos[1] + 1)
EndFunc

Func MovLt()
	$Pos = MouseGetPos()
	mousemove($Pos[0] -1, $Pos[1])
EndFunc

Func MovRt()
	$Pos = MouseGetPos()
	mousemove($Pos[0] + 1, $Pos[1])
EndFunc

Oh and here is another one I made that copies to clipboard the color of the x,y spot you write into the textboxes.
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ColorGet", 215, 144, 192, 124)
$Input1 = GUICtrlCreateInput("X-Coord", 35, 90, 52, 21)
$Input2 = GUICtrlCreateInput("Y-Coord", 120, 90, 52, 21)
$Label1 = GUICtrlCreateLabel("Press 'insert' To copy color to Clipboard" &@LF&@LF& "You can press End or click the X to exit" , 5, 33, 200, 55, $SS_CENTER)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

WinSetOnTop($Form1, "", 1)
Global $wWindow = "[Class:Valve001]" ; Name class of $wWindow
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 1)



HotKeySet("{INSERT}", "Copy")
HotKeySet("{End}", "End")

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd

Func Copy()
	$xcoord = guictrlread($input1)
	$ycoord = guictrlread($input2)
	WinActivate($wWindow)
	WinWaitActive($wWindow)
	If WinActive($wWindow,"") Then
		$col = PixelGetColor ($xcoord, $ycoord)
		$colHex = stringreplace(hex($col),2,"x")
		clipput($colHex)
		tooltip("Color Copied - " & $colHex)
	EndIf
EndFunc

Func End()
	Exit
EndFunc
Good job ^.^
And of course, most people in this section dont know what it is and cant use it <.< What leechers.
But nice DanK and as Pie said Good Job.
Very useful to find coordinates, I would know it was included as part of your source .. used this to modify your script quite a bit.
Back then, you were nunya
But now, you are DanK
Made awesome hax then AND now.
Who reads titles anyway?
I have a feeling that this is used to determine if the boat launched or not...
Unfortunately, still too complex for me
Quote Originally Posted by badhomaks View Post
I have a feeling that this is used to determine if the boat launched or not...
Unfortunately, still too complex for me
They are just tools to get colors and mouse coords.
Finally you made it public, anyways, nice work =P
im so proud of myself for knowing how to use this now

Thanks for the release
Posts 19 of 9 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?