Sign in to follow this  
Followers 0
ccmt19

Controlclick?

6 posts in this topic

#1 ·  Posted (edited)

I tried to make my scrip run with inactive window, how can i use my mouseclick's coordinate with controlclick (I've check & that window has no controlID :) )

Edited by ccmt19

Share this post


Link to post
Share on other sites



; Note GUI must be active for this to work ...
Opt("MouseCoordMode", 0)
$x = 48; use the real x coordinate to click, relative to GUI
$y = 39; use the real y coordinate to click, relative to GUI
MouseClick("left", $x, $y, 1, 0)


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

I tried to make my scrip run with inactive window, how can i use my mouseclick's coordinate with controlclick (I've check & that window has no controlID :) )

Try using ControlClick with "" as the ControlID parameter, ex:

ControlClick("Window", "", "", "left")

Share this post


Link to post
Share on other sites

i tried this

run("C:\WINDOWS\system32\mspaint.exe")
WinWaitActive("untitled - Paint")
WinSetState ( "untitled - Paint", "", @SW_MINIMIZE )
sleep(2000)
WinSetTitle("untitled - Paint","","ccmt19")
sleep(2000)
Opt("MouseCoordMode", 0)
$x = 200
$y = 250
MouseClick("left", $x, $y, 1, 0)

and this

run("C:\WINDOWS\system32\mspaint.exe")
WinWaitActive("untitled - Paint")
WinSetState ( "untitled - Paint", "", @SW_MINIMIZE )
sleep(2000)
WinSetTitle("untitled - Paint","","ccmt19")
sleep(2000)
ControlClick("ccmt19","","", "left", 1)
sleep(2000)

but didn't work. Did i make any mistake? Help me to correct it please :)

Share this post


Link to post
Share on other sites

Try this(if it's mspaint you want to automate, it has a controlID you can use. called "Afx:1000000:81":

Opt("WinTitleMatchMode", 4)

Run("mspaint.exe")

WinWait("[CLASS:MSPaintApp]")
$wPos = ControlGetPos("[LAST]", "", "Afx:1000000:81") ; get the size of the control
WinSetState("[LAST]", "", @SW_MINIMIZE) ; minimize the window
Dim $x2 = Int(($wPos[2]/2)) ; funny stuff
For $x = 1 To Int(($wPos[2]/2))
    ConsoleWrite("x: " & $x & @TAB & "y: " & $x & @LF) ; show us where we're at!
    ControlClick("[LAST]", "", "Afx:1000000:81", "left", 1, $x, $x) ; click inside the paint control
    ControlClick("[LAST]", "", "Afx:1000000:81", "left", 1, $x2, $x) ; funny stuff
    $x2 -= 1 ; funny stuff
Next

That clicks in the control, and draws a cross.. :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

i'm srr because i didn't mention it clearly :) ...

i used mspaint as an example (so i can check if it has been clicked)

the window that i worked with, it has no controlID .

btw, it's useful stuff, i think i should try with some new functions :)

Edited by ccmt19

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0