Sign in to follow this  
Followers 0
Kiti

MousegetCursor or loop error

4 posts in this topic

#1 ·  Posted (edited)

Here's my code:

$speed = 2
Global $x = 1

If $x = 1 Then
    For $1 = 0 To 14
        MouseMove(788, 630 + $1 * 5, $speed)
        For $2 = 0 To 14
            MouseMove(788 + $2 * 5, 630 + $1 * 5, $speed)
            $cursor = MouseGetCursor()
            If $cursor = 11 Then
                Global $x = 2
            EndIf
        Next
    Next
EndIf

The SciTe's console is in mouse's way, but when he turns in a vertical resizing arrow, the script doesn't exit. Do you know why?

Edit: If I put a msgbox instead of declaring $x, I get it. So that declaration doesn't influence the first if loop. Is there anything like ExitAllLoops ? If I put an ExitLoop it exits only the 3rd/last one.

How can I exit the entire loop if the mouse changes?

Edited by Kiti

Share this post


Link to post
Share on other sites



By the time it would set $x to 2 it is already inside the loops so it wont stop until it is done

If you want it to exit the loops when it finds the cursor

add this in in

ExitLoop 2oÝ÷ Ù§íz»ay«­¢+Ù±½°ÀÌØíàô

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The $x variable doesn't do anything in the script you posted so unless it's used somewhere else (or have some other mysterious meaning :) ) you may as well remove it

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

The $x variable doesn't do anything in the script you posted so unless it's used somewhere else (or have some other mysterious meaning :) ) you may as well remove it

:P) No, it doesn't. I just want to click and exit the loop when the cursor chages.

Here's my workaround :P :

For $1 = 0 To 14
        MouseMove(788, 630 + $1 * 5, $speed)
        For $2 = 0 To 14
            MouseMove(788 + $2 * 5, 630 + $1 * 5, $speed)
            global $cursor = MouseGetCursor()
            if $cursor = 0 Then
            MouseClick("Left")
            sleep(100)
            _mousetrap(0,0,10,10)
            EndiF
        Next
    Next

Even though it waits till all the movements are finished, it click ony once, and that's what I need.

Thank you narayanjr for your help!

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