Home PDF Splitter Phantom Mouse Get File Names Proxy Web Requests Google Traffic Gmail Price Alerts Trading Bot What's My Public IP HEX-ASCII Converter Stableford Calculator CV Golf Ball Tracer QR Code Generator About Me

Python

PShell

Phantom Mouse

Real simple code, it moves the mouse between two pre-set locations and clicks. Stops your computer from logging out until you end the script (or you run out of battery). There's two versions:

1) Python (Windows only):

import win32api, win32con import time x1 = 700 y1 = 5 x2 = 900 y2 = 5 waittime = 10 def click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) time.sleep(waittime) def move(x,y): win32api.SetCursorPos((x,y)) while(1): move(x1, y1) click(x1, y1) move(x2, y2) click(x2, y2) end


2) Powershell:

Clear-Host [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $XValue1 = 1246 $YValue1 = 0 $XValue2 = 1448 $YValue2 = 0 $SendMouseClick = Add-Type -memberDefinition @' [DllImport("user32.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo); '@ -name "Win32MouseEventNew" -namespace Win32Functions -passThru while ($true) { [system.windows.forms.cursor]::Position = New-Object System.Drawing.Point($XValue1,$YValue1) Start-Sleep -Seconds 10 [system.windows.forms.cursor]::Position = New-Object System.Drawing.Point($XValue2,$YValue2) $SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0); $SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0); Start-Sleep -Seconds 10 }