Skip to content

Instantly share code, notes, and snippets.

@bennettaur
Created July 19, 2013 00:59
Show Gist options
  • Save bennettaur/6034326 to your computer and use it in GitHub Desktop.
Save bennettaur/6034326 to your computer and use it in GitHub Desktop.
This is a small VB script that moves a person's cursor to a random spot on their screen. It relies on Excel to run a macro.
Option Explicit
Dim Excel, x, y, i
Dim min, max
Randomize
min = 0
max = 500
Set Excel = WScript.CreateObject("Excel.Application")
Do While True
x = ((max-min+1)*Rnd+min)
y = ((max-min+1)*Rnd+min)
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""SetCursorPos"",""JJJ""," & x & "," & y & ")")
WScript.Sleep (5000)
Loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment