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:
Profil mememe12
Femeie
23 ani
Bucuresti
cauta Barbat
23 - 80 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [VBS] Move Mouse Cursor to X, Y Physical Coordinates, then Left Click Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
After finding out the desired coordinates using:

I used the following snippet found on multiple sites, to move the mouse cursor to a specific location on my 2nd monitor.


Dim Excel, x, y

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

x = "-731"
y = "539"
Excel.ExecuteExcel4Macro ( _
    "CALL(""user32"",""SetCursorPos"",""JJJ""," & x & "," & y & ")")

WScript.Sleep (100)


The code uses Excel no move the cursor because apparently VBS doesn't have a native function to do that.

I know there are options using AutoHotkey, AutoIt or other similar programs, but I use the above snippet inside a HTA so I need it in VBS.


pus acum 3 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Left clicking the mouse requires the following additional lines after the code above:


' LEFT CLICK UP

Excel.ExecuteExcel4Macro ( _
"CALL(""user32"",""mouse_event"",""JJJJJJ""," & "2" & ")")

WScript.Sleep (25)

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


The 2 and the 4 represent LEFT CLICK DOWN and LEFT CLICK UP.

- 1 = MOVE
- 2 = LEFT CLICK DOWN
- 4 = LEFT CLICK UP
- 8 = RIGHT CLICK DOWN
- 10 = RIGHT CLICK UP
- 20 = MIDDLE CLICK DOWN
- 40 = MIDDLE CLICK UP
- 8000 = ABSOLUTE


Source:


pus acum 3 ani
   
Pagini: 1  

Mergi la