Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Anna281 la Simpatie.ro
Femeie
25 ani
Iasi
cauta Barbat
25 - 44 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [VBS] Move and Click Mouse Using an Old Excel Function Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
The following code uses an old Excel function existing in VBA to move the cursor and click the mouse at various coordinates on 2 screens (laptop + monitor).


Option Explicit
Dim Excel, x, y

Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_ABSOLUTE = &H8000

Set Excel = WScript.CreateObject("Excel.Application")

x = "-731"
y = "539"

' MOVE
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""SetCursorPos"",""JJJ""," & x & "," & y & ")")

WScript.Sleep (50)

' LEFT CLICK DOWN
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "2" & ")")

WScript.Sleep (50)

' LEFT CLICK UP
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "4" & ")")

WScript.Sleep (50)

x = "-731"
y = "300"

' MOVE
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""SetCursorPos"",""JJJ""," & x & "," & y & ")")

WScript.Sleep (50)

' RIGHT CLICK DOWN
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "8" & ")")

WScript.Sleep (50)

' RIGHT CLICK UP
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "10" & ")")

WScript.Sleep (50)

x = "-700"
y = "360"

' MOVE
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""SetCursorPos"",""JJJ""," & x & "," & y & ")")

WScript.Sleep (50)

' LEFT CLICK DOWN
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "2" & ")")

WScript.Sleep (50)

' LEFT CLICK UP
Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "4" & ")")


_______________________________________


pus acum 3 ani
   
Pagini: 1  

Mergi la