Created
July 21, 2017 01:28
-
-
Save watson0x90/17ffb8fe1783827b22e4e9cf4846b059 to your computer and use it in GitHub Desktop.
Make the mouse go click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Windows.Forms | |
$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen | |
[Windows.Forms.Cursor]::Position = "$($screen.Width),$($screen.Height)" | |
function Click-MouseButton | |
{ | |
$signature=@' | |
[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); | |
'@ | |
$SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru | |
$SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0); | |
$SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0); | |
} | |
Click-MouseButton |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment