Jump to content

MousegetCursor or loop error


Recommended Posts

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
Link to comment
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

Edited by AdmiralAlkex
Link to comment
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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...