Sign in to follow this  
Followers 0
Bert

Mouseclick bug - need verification please - script provided

4 posts in this topic

This is a script that reproduces the problem. The issue is with line 75. If mousemove is set to 1, the click occurs. If set to 0, it is skipped. I put in hotsetkeys to change the move value.

When running the script:

"q" will start the mouseclick pattern

"w" will set the move to 1

"e" will set the move to 0

"r" will stop the pattern.

the esc key will exit the script.

notepad will open and size itself. It has to be active for the mouseclick pattern to run.

script:

opt("Wintitlematchmode", 2)
$u=0
$p=0
$z = 864
$c = 493
$L = 1
HotKeySet("{esc}", "exitProgram")
dim $qwe = "Untitled - Notepad"
$np = WinExists($qwe)
IF  $np = 0 then
    run("Notepad.exe")
    winmove($qwe, "", 522, 107, 911, 626, 0)
EndIf

while 1
    $e = WinActive("Untitled - Notepad","")
    If $e <> 0 then
        clickactive()
    endif
    If WinActive("Untitled - Notepad","") = 0 then
        resetkey()
    endif
sleep(100)
wend

Func clickactive()
    HotKeySet("q", "xxx")
    HotKeySet("r", "xxx2")
    HotKeySet("w", "xxx3")
    HotKeySet("e", "xxx4")
EndFunc

Func resetkey()
    HotKeySet("q")
    HotKeySet("r")
    HotKeySet("w")
    HotKeySet("e")
EndFunc

Func xxx3()
    $L = 1
EndFunc

Func xxx4()
    $L = 0
EndFunc

Func xxx()
    $u = 1
    clicker()
EndFunc

FUnc xxx2()
    $u = 0
EndFunc

Func clicker()
    $d = $c
    $z2 = $z
    if $u= 1 then
        while 1
            If WinActive($qwe,"") <> 0 then
                Do
                MouseClick("left",$z2 , $d, 1, 0)
                $d = $d + 20
                until $d = 473 + 200
            endif
            If WinActive($qwe,"") = 0 then ExitLoop
            $pp = 1
            If $u = 0 then ExitLoop
            $d = $c
            $z2 = $z2 + 30
            if $z2 > 1260 then
                $z2 = $z
                MouseClick("left",736, 643,$L) ;bug is here. If I set the move to 0, the click is skipped
                sleep(500)
            EndIf
        WEnd
    endif
EndFunc

Func exitProgram()
    Exit
EndFunc

Share this post


Link to post
Share on other sites



Bert,

MouseClick("left", 736, 643, $L) ;bug is here. If I set the move to 0, the click is skipped

$L is the number of times to click.  Is that your intent?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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