- Offizieller Beitrag
Hi,
hier ist Platz für ein paar Mouseskripte.
Mouse anhalten per misc
Spoiler anzeigen
#include <Misc.au3>
[/autoit] [autoit][/autoit] [autoit]HotKeySet("+!h","_holdMouse")
[/autoit] [autoit][/autoit] [autoit]Func _holdMouse()
$Pos = MouseGetPos()
_MouseTrap($Pos[0],$Pos[1])
HotKeySet("+!h","_releaseMouse")
EndFunc
Func _releaseMouse()
_MouseTrap()
HotKeySet("+!h","_holdMouse")
EndFunc
While 1
Sleep(200)
WEnd
Mouse anhalten ohne misc
Spoiler anzeigen
Opt("OnExitFunc", "endscript")
[/autoit] [autoit][/autoit] [autoit]HotKeySet("1", "end")
HotKeySet("3", "start")
While 1
Sleep(100)
WEnd
Func start()
Local $pos = MouseGetPos()
_MouseStop($pos[0], $pos[1])
For $i = 0 To 20
ToolTip($i & " of 20")
Sleep(100)
Next
_MouseStop()
ToolTip('')
EndFunc ;==>start
Func _MouseStop($posX = 0, $posY = 0)
Local $av_ret
If @NumParams = 2 Then
Local $Rect = DllStructCreate("int;int;int;int")
If @error Then Return 0
DllStructSetData($Rect, 1, $posX)
DllStructSetData($Rect, 2, $posY)
DllStructSetData($Rect, 3, $posX)
DllStructSetData($Rect, 4, $posY)
$av_ret = DllCall("user32.dll", "int", "ClipCursor", "ptr", DllStructGetPtr($Rect))
ElseIf @NumParams = 0 Then
$av_ret = DllCall("user32.dll", "int", "ClipCursor", "int", 0)
EndIf
Return $av_ret[0]
EndFunc ;==>_MouseStop
Func end()
Exit (0)
EndFunc ;==>end
Func endscript()
_MouseStop()
Exit (0)
EndFunc ;==>endscript
Mouse Warp (läuft durch den Monitor)
Spoiler anzeigen
HotKeySet("{Esc}","_Exit")
[/autoit] [autoit][/autoit] [autoit]_MouseWrap()
[/autoit] [autoit][/autoit] [autoit]Func _MouseWrap()
TrayTip("hot key:","press Esc to exit",30)
While 1
$pos = MouseGetPos()
If $pos[0] < 2 Then MouseMove(@DeskTopWidth - 2, $pos[1], 1)
If $pos[0] > @DeskTopWidth - 2 Then MouseMove(2, $pos[1], 1)
If $pos[1] < 2 Then MouseMove($pos[0], @DesktopHeight - 2, 1)
If $pos[1] > @DeskTopHeight - 2 Then MouseMove($pos[0], 2, 1)
Sleep(1)
Wend
EndFunc
Func _Exit()
Exit
EndFunc
Mouse aus Bereich fernhalten
Spoiler anzeigen
Global $GUI = GUICreate("Can't Touch This", 200, 100, 200, 200)
GUISetState()
AdlibEnable("CallMouseRepel", 10)
While 1
Sleep(1000)
WEnd
Func CallMouseRepel()
$coords = WinGetPos($GUI)
_MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])
EndFunc ;==>CallMouseRepel
Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)
Local $a_MousePos = MouseGetPos()
Local $i_XCordinate = -1, $i_YCordinate = -1
If $a_MousePos[0] >= $i_left And $a_MousePos[0] <= $i_right Then
If ($a_MousePos[0] - $i_left) < ($i_right - $a_MousePos[0]) Then
$i_XCordinate = $i_left - 1
Else
$i_XCordinate = $i_right + 1
EndIf
EndIf
If $a_MousePos[1] >= $i_top And $a_MousePos[1] <= $i_bottom Then
If ($a_MousePos[1] - $i_top) < ($i_bottom - $a_MousePos[1]) Then
$i_YCordinate = $i_top - 1
Else
$i_YCordinate = $i_bottom + 1
EndIf
EndIf
If $i_XCordinate <> -1 And $i_YCordinate <> -1 Then
If Abs($i_XCordinate - $a_MousePos[0]) > Abs($i_YCordinate - $a_MousePos[1]) Then
MouseMove($a_MousePos[0], $i_YCordinate, 1)
ElseIf Abs($i_XCordinate - $a_MousePos[0]) < Abs($i_YCordinate - $a_MousePos[1]) Then
MouseMove($i_XCordinate, $a_MousePos[1], 1)
Else
MouseMove($i_XCordinate, $i_YCordinate, 1)
EndIf
EndIf
EndFunc ;==>_MouseRepel
Mauszeigertauschen
Spoiler anzeigen
#cs
mode = 1 for swapping
mode = 0 for returning to normal mode
#ce
SwapMouseButton(1)
ToolTip("swapped!", 0, 0)
Sleep(5000)
SwapMouseButton(1) ; Ich muss immer swappen
ToolTip("Normal!", 0, 0)
Func SwapMouseButton($mode = 1)
DllCall("user32.dll", "int", "SwapMouseButton", "int", $mode)
EndFunc ;==>SwapMouseButton
_SwitchMousePrimary(_MouseGetPrimary())
Func _MouseGetPrimary()
Local $aDLLMButton = DllCall('User32.dll', 'int', 'SwapMouseButton', 'int', True)
If IsArray($aDLLMButton) And $aDLLMButton[0] <> 0 Then Return 0
If IsArray($aDLLMButton) And $aDLLMButton[0] = 0 Then DllCall('User32.dll', 'int', 'SwapMouseButton', 'int', False)
Return 1
EndFunc ;==>_MouseGetPrimary
Func _SwitchMousePrimary($nPrimary)
Return DllCall('User32.dll', 'int', 'SwapMouseButton', 'int', $nPrimary)
EndFunc
Mouseclickzeit messen
Spoiler anzeigen
While 1
$LeftClick = _TimeClick('01')
If $LeftClick Then MsgBox(64, 'Info:', 'Left mouse was held for: ' & StringFormat('%i second(s) or %i millisecond(s)', Mod($LeftClick, 60), $LeftClick * 1000))
Sleep(10)
WEnd
Func _TimeClick($vKey)
Local $MouseDownTime
If _IsPressed($vKey) Then
$MouseDownTime = TimerInit()
While _IsPressed($vKey)
Sleep(10)
WEnd
Return TimerDiff($MouseDownTime) / 1000
EndIf
Return 0
EndFunc
Func _IsPressed($v_R, $v_dll = 'user32.dll')
$v_R = DllCall($v_dll, 'int', 'GetAsyncKeyState', 'int', '0x' & $v_R)
Return (Not @error And BitAND($v_R[0], 0x8000) = 0x8000) * 1
EndFunc
Mouse Bewegungsrichtungen
Spoiler anzeigen
$gesture = "896321478"
$sleep = 100
$debug = True
#cs
DIRECTIONS:
numpad-sytle
7 8 9
[/autoit] [autoit][/autoit] [autoit]4 + 6
[/autoit] [autoit][/autoit] [autoit]1 2 3
[/autoit] [autoit][/autoit] [autoit]#ce
[/autoit] [autoit][/autoit] [autoit]Global Const $pi = 3.14159265358979
$current = ""
$direction = ""
$timer = TimerInit()
While 1
$pos_old = MouseGetPos()
Sleep($sleep)
$pos_new = MouseGetPos()
If $pos_new[0] = $pos_old[0] and $pos_new[1] = $pos_old[1] Then ContinueLoop
If TimerDiff($timer) > 500 Then $current = ""
$a = GetAnglePO($pos_new[0] - $pos_old[0], $pos_new[1] - $pos_old[1]) * 57.2957795130823
Select
Case $a >= 337.5 or $a < 22.5
$direction = "6"
Case $a >= 22.5 and $a < 67.5
$direction = "3"
Case $a >= 67.5 and $a < 112.5
$direction = "2"
Case $a >= 112.5 and $a < 157.5
$direction = "1"
Case $a >= 157.5 and $a < 202.5
$direction = "4"
Case $a >= 202.5 and $a < 247.5
$direction = "7"
Case $a >= 247.5 and $a < 292.5
$direction = "8"
Case $a >= 292.5 and $a < 337.5
$direction = "9"
EndSelect
If $direction <> StringRight($current, 1) Then $current &= $direction
If $debug Then ToolTip("Current:" & @TAB & $current & @CRLF & "Direction:" & @TAB & $direction)
If StringInStr($current, $gesture) Then
MsgBox(0, "gesture", $current)
$current = ""
EndIf
$timer = TimerInit()
WEnd
Func GetAnglePO( $x, $y ) ;by blindwig
Select
Case $x > 0
If $y >= 0 Then
Return ATan($y / $x)
Else
Return ATan($y / $x) + 2 * $pi
EndIf
Case $x = 0
If $y = 0 Then
Return 0
ElseIf $y > 0 Then
Return $pi / 2
Else
Return 3 * $pi / 2
EndIf
Case $x < 0
Return ATan($y / $x) + $pi
EndSelect
EndFunc
Reale Mausbewegungen simuliert
Spoiler anzeigen
;WinMinimizeAll()
;mousemovereal(0,0,3,0,1)
;mousemovereal(200,200,3,0,1)
;mouseclickreal("left",50,100,1,1,0,1)
;mouseclickdragreal("left",100,100,400,400,1,1,10,0)
;mousedownreal("left")
;mousemovereal(600,600,1,0,1)
;mouseupreal("left")
;WinMinimizeAllUndo()
Testreal2(1,1);1=X ,2=Y ,3=Speed << How higher , how faster
; Note : 1 = x goto.
; 2 = y goto.
; 3 = Speed behide steps
; 4 = The total of steps .. For a nice example use speed 10 and steps 2
; 5 = automatic makes a the good step number. 1 to enable , 0 to disable
;This is named "Mousemovereal", something which simulates a normally moving mouse cursor. Be honest,
;how many times do you draw a straight line from point a to point b?
; If you're lucky, that means if blizzard is running a detector you don't want to be making perfect straight lines all the time.
;This function moves your mouse to the desired position, but not in a straight line
;
;dit is mousemovereal dat betekend dat het een echte mousemove na maakt , want zeg zelf , hoe vaak
;trek je een rechte lijn van a tot b ? soms als je een keer mazzel hebt , dus als blizzard een
;detector heeft draaien moet je niet altijd een perfecte rechte lijn maken , daarom gebruik deze funcie
;deze is niet recht maar gaat wel naar gewenste posietie
;
;This is mouseclickreal , this is the same as mousemovereal but then with click funcion , parameters 1=Button 2=x 3=y 4=speed 5=nubclick 6=steps
func mousemovereal($x,$y,$speed,$steps,$Auto)
; The mousemover , but he dont make a perfect line
dim $q[2]
$q[0] = $x
$q[1] = $y
$p = MouseGetpos()
$len = Sqrt(($p[0]+$q[0])*($p[0]+$q[0]))+(($p[1]+$q[1])*($p[1]+$q[1]))
if $Auto = 1 Then
$steps = $len / 2000
tooltip("Auto Steps :"&$steps)
endif
$mousestart = MouseGetpos()
for $i = 1 to $steps
mousemove(($p[0]+($i*($q[0]-$p[0])/$steps))+random(random(-2,0),random(0,2)),$p[1]+($i*($q[1]-$p[1])/$steps)+random(random(-2,0),random(0,2)),$speed)
$Secondmove = MouseGetPos()
next
mousemove($x,$y,$speed)
endfunc
func mouseclickreal($button ,$x,$y,$speed,$Nubofclicks,$steps,$Auto)
;A mouseclick without a perfect line mouse move
mousemovereal($x,$y,$speed,$steps,$Auto)
$pos = mousegetpos()
mouseclick($button,$pos[0],$pos[1],$Nubofclicks)
EndFunc
func mouseclickdragreal($button,$x,$y,$x2,$y2,$speed,$Nubofclicks,$steps,$Auto)
;Drag with a real mouse move , How mutch time you move your mouse really in a perfect line ? , why you shall do it perfect in drag?
mousemovereal($x,$y,$speed,$steps,$Auto)
mousedown($button)
mousemovereal($x2,$y2,$speed,$steps,$Auto)
mouseup($button)
endfunc
func mousedownreal($button)
;Maby its sicko , but do you click your mouse without a little mouse move ?
$pos = MouseGetPos()
mousemove($pos[0]-random(random(-2,0),random(0,2)),$pos[1]-random(random(-2,0),random(0,2)),1)
mousedown($button)
EndFunc
func mouseupreal($button)
;Maby its sicko , but do you click your mouse without a little mouse move ?
$pos = MouseGetPos()
mousemove($pos[0]-random(random(-2,0),random(0,2)),$pos[1]-random(random(-2,0),random(0,2)),1)
mouseup($button)
EndFunc
;\/ = beta , alpha
; This here under is beta testing , TestReal Works..
; \/ = beta , alpha
func TestReal($x,$y)
dim $q[2]
$q[0] = $x
$q[1] = $y
$p = MouseGetpos()
$len = Sqrt(($p[0]+$q[0])*($p[0]+$q[0]))+(($p[1]+$q[1])*($p[1]+$q[1]))
$steps = $len / 1000
tooltip("Auto Steps :"&$steps)
sleep(5000)
$mousestart = MouseGetpos()
for $i = 1 to $steps
mousemove(($p[0]+($i*($q[0]-$p[0])/$steps))+random(random(-2,0),random(0,2)),$p[1]+($i*($q[1]-$p[1])/$steps)+random(random(-2,0),random(0,2)),1)
$S = MouseGetPos()
tooltip("Auto Steps :"&sqrt(($S[0]+$q[0])*($S[0]+$q[0]))+(($S[1]+$q[1])*($S[1]+$q[1]))/1000,0,05)
next
mousemove($x,$y,1)
endfunc
func TestReal2($x,$y)
$do = 1
dim $q[2]
$q[0] = $x
$q[1] = $y
$p = MouseGetpos()
$len = Sqrt(($p[0]+$q[0])*($p[0]+$q[0]))+(($p[1]+$q[1])*($p[1]+$q[1]))
$steps = $len / 1000
$Random=random(0,1)
tooltip("Auto Steps :"&$steps&"|random :"&$random)
$do = 0
if $Random > 1.75 Then
$Do = 1
endif
;sleep(5000)
If $do =1 Then
dim $r[2]
dim $s[2]
$s[0]=$p[0] /(+(Cos($q[1])*2))
$s[1]=$p[1] /(+(Cos($q[0])*2))
$r[0]=$q[0] /(+(Cos($p[1])*2))
$r[1]=$q[1] /(+(Cos($p[0])*2))
$max = random(-$steps,$steps)
for $count = 1 to +$max
$i = $max
mousemove(($s[0]+($i*($r[0]-$s[0])/$steps))+random(random(-2,0),random(0,2)),$s[1]+($i*($r[1]-$s[1])/$steps)+random(random(-2,0),random(0,2)),1)
tooltip("Auto Steps :"&sqrt(($S[0]+$q[0])*($S[0]+$q[0]))+(($S[1]+$q[1])*($S[1]+$q[1]))/1000,0,05)
next
return TestReal2($q[0],$q[1])
endif
$mousestart = MouseGetpos()
for $i = 1 to $steps
mousemove(($p[0]+($i*($q[0]-$p[0])/$steps))+random(random(-2,0),random(0,2)),$p[1]+($i*($q[1]-$p[1])/$steps)+random(random(-2,0),random(0,2)),1)
$S = MouseGetPos()
tooltip("Auto Steps :"&sqrt(($S[0]+$q[0])*($S[0]+$q[0]))+(($S[1]+$q[1])*($S[1]+$q[1]))/1000,0,05)
next
EndFunc
Lustige Mausbewegungen
Spoiler anzeigen
; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1 beta
; Author: Thorsten Meger
;
; Script Function: Mouse move around
;
; ----------------------------------------------------------------------------
#include<Array.au3>
#include <math.au3>
HotKeySet("{esc}", "end")
HotKeySet("1", "moveRandom")
HotKeySet("2", "moveButterfly")
Global Const $OCR_APPSTARTING = "AppStarting"
Global Const $OCR_NORMAL = 32512
Global Const $OCR_CROSS = 32515
Global Const $OCR_HAND = 32649
Global Const $OCR_IBEAM = 32513
Global Const $OCR_NO = 32648
Global Const $OCR_SIZEALL = 32646
Global Const $OCR_SIZENESW = 32643
Global Const $OCR_SIZENS = 32645
Global Const $OCR_SIZENWSE = 32642
Global Const $OCR_SIZEWE = 32644
Global Const $OCR_UP = 32516
Global Const $OCR_WAIT = 32514
Dim $mouseFuncs = 0
Dim $cursorArray
$cursorArray = _ArrayCreate ("3dgarro.cur")
$search = FileFindFirstFile(@WindowsDir & "\cursors\*.*")
If $search = -1 Then
MsgBox(0, "Error", "No Cursors found!")
Exit
EndIf
While 1
$cursor = FileFindNextFile($search)
If @error Then ExitLoop
_ArrayAdd($cursorArray, $cursor)
WEnd
FileClose($search)
While 1
If Random(0, 1, 1) = 1 Then
changeCursor()
EndIf
Sleep(1500)
WEnd
Func changeCursor()
$nr = Random($cursorArray[0], UBound($cursorArray) - 1, 1)
_SetCursor(@WindowsDir & "\cursors\" & $cursorArray[$nr], $OCR_NORMAL)
EndFunc ;==>changeCursor
Func _SetCursor($s_file, $i_cursor)
Local $newhcurs, $lResult
$newhcurs = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $s_file)
If Not @error Then
$lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor)
If Not @error Then
$lResult = DllCall("user32.dll", "int", "DestroyCursor", "int", $newhcurs[0])
Else
MsgBox(0, "Error", "Failed SetSystemCursor")
EndIf
Else
MsgBox(0, "Error", "Failed LoadCursorFromFile")
EndIf
EndFunc ;==>_SetCursor
Func end()
exit (0)
EndFunc ;==>end
Func restoreCursor()
Run('RunDll32.exe shell32.dll,Control_RunDLL main.cpl @0,1')
WinWait('Eigenschaften von Maus')
ControlSend('Eigenschaften von Maus', '', '', '{Enter}')
EndFunc ;==>restoreCursor
Func moveRandom()
While 1
MouseMove(Random(0, @DesktopWidth, 1), Random(0, @DesktopHeight, 1))
If Random(0, 1, 1) = 1 Then
changeCursor()
EndIf
WEnd
EndFunc ;==>moveRandom
Func moveButterfly()
Global Const $PI = 3.1415926535897932384626433832795
Dim $t
Dim $expr
For $theta = 0 To 924 * $PI;ALSO MAKE THE LOOP GO LONGER
$t = _Radian ($theta)
$expr = Exp(Cos($t)) - 2 * Cos(4 * $t) - Sin($t / 12) ^ 5
$x = 400 + 100 * Cos($t) * $expr
$y = 400 + 100 * Sin($t) * $expr
ConsoleWrite($x & "," & $y & @LF);Use for debugging with SciTE
If Random(0, 80, 1) = 1 Then
changeCursor()
EndIf
MouseMove($x, $y, 1)
Next
EndFunc ;==>moveButterfly
Func OnAutoItStart()
;saveCurrentCursor()
EndFunc ;==>OnAutoItStart
Func OnAutoItExit()
restoreCursor()
EndFunc ;==>OnAutoItExit
Func saveCurrentCursor()
;DllCall...
EndFunc ;==>saveCurrentCursor
Mausrichtungen tauschen
Spoiler anzeigen
HotKeySet("{ESC}", "end")
[/autoit] [autoit][/autoit] [autoit]HotKeySet("^!i","_InvertOnOff")
HotKeySet("^!x","_InvertXOnOff")
HotKeySet("^!y","_InvertYOnOff")
Global $MouseStart = _GetCursorPos()
Global $MousePos
Global $InvertX = True ; X-Achse tauschen (rechts-links)
Global $InvertY = True ; Y-Achse tauschen (hoch-runter)
Global $InvertOn = False
While 1
If $InvertOn Then
$MousePos = _GetCursorPos()
$Dx = $MousePos[0] - $MouseStart[0]
$Dy = $MousePos[1] - $MouseStart[1]
; Mousepositionen am Rand korrigieren
If $Dx > 1500 Then $Dx = -1
If $Dy > 1500 Then $Dy = -1
If $Dx < -1500 Then $Dx = 1
If $Dy < -1500 Then $Dy = 1
If $InvertX Then
$MouseStart[0] = $MousePos[0] - 2 * $Dx
Else
$MouseStart[0] = $MousePos[0]
EndIf
If $InvertY Then
$MouseStart[1] = $MousePos[1] - 2 * $Dy
Else
$MouseStart[1] = $MousePos[1]
EndIf
_SetCursorPos($MouseStart[0], $MouseStart[1])
EndIf
Sleep(2) ; Prozessor entlasten
Wend
Func _InvertOnOff()
If $InvertOn Then
$InvertOn = False
Else
$InvertOn = True
$MouseStart = _GetCursorPos()
EndIf
EndFunc
Func _GetCursorPos()
Local $Pt = DllStructCreate("uint;uint")
Local $RetVal[2]
DllCall("user32.dll", "long", "GetCursorPos", "ptr", DllStructGetPtr($Pt))
$RetVal[0] = DllStructGetData($Pt,1)
$RetVal[1] = DllStructGetData($Pt,2)
Return $RetVal
EndFunc
Func _SetCursorPos($PosX, $PosY)
DllCall("user32.dll", "long", "SetCursorPos", "long", $PosX, "long", $PosY)
EndFunc
Func _InvertXOnOff()
if $InvertX Then
$InvertX = False
Else
$InvertX = True
EndIf
EndFunc
Func _InvertYOnOff()
if $InvertY Then
$InvertY = False
Else
$InvertY = True
EndIf
EndFunc
Func end()
Exit(0)
EndFunc
Maussound
Spoiler anzeigen
#include <misc.au3>
HotKeySet("{end}", "end")
$P = 1
While 1
If (_IsPressed("01") And _IsPressed("02") And _IsPressed("04")) Or $P Then;to exit script you have to hold the buttons half a second
Sleep(500)
If _IsPressed("01") Or _IsPressed("02") Then $P = 0;if left/rigth mousebutton is klicked start beepthing
If _IsPressed("01") And _IsPressed("02") And _IsPressed("04") Then Exit;if left+right+third mousebutton is klicked exit script
Else
$Mouse = MouseGetPos()
$Frequenz = ($Mouse[0] / 18 + 10) * ($Mouse[1] / 18 + 10);different sounds for mouse coords
If _IsPressed("01") Then $Frequenz += 100
If _IsPressed("02") Then $Frequenz += 200;higher sound if left/right mousebutton clicked
Beep($Frequenz, 50)
EndIf
WEnd
Func end()
Exit
EndFunc ;==>end
So long,
Mega