Sign in to follow this  
Followers 0
SkyBlzr

Basic Loop problem

15 posts in this topic

Could anyone tell me what's wrong with this? The error is, EndIf statement with no matching If statement :unsure:

Attempting to make the mouse continue to click while holding down the left mouse button.

While 1
    Sleep(10)
    If _IsPressed("01") Then ContinueLoop
        MouseDown("Left")
        Sleep(10)
        MouseUp("Left")
    EndIf  

WEnd

Share this post


Link to post
Share on other sites



Your ContinueLoop needs to be on its own line otherwise you're closing the If statement with it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

This is were Tidy could help you out :unsure:

While 1
    Sleep(10)
    If _IsPressed("01") Then ContinueLoop
    MouseDown("Left")
    Sleep(10)
    MouseUp("Left")
;### Tidy Error -> "endif" is closing previous "while" on line 1
EndIf

;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Could anyone tell me what's wrong with this? The error is, EndIf statement with no matching If statement :unsure:

Attempting to make the mouse continue to click while holding down the left mouse button.

While 1
    Sleep(10)
    If _IsPressed("01") Then ContinueLoop
        MouseDown("Left")
        Sleep(10)
        MouseUp("Left")
    EndIf  

WEnd

While 1
    Sleep(10)
    If _IsPressed("01") Then 
        ContinueLoop
        MouseDown("Left")
        Sleep(10)
        MouseUp("Left")
    EndIf  

WEnd
Edited by happytc

Share this post


Link to post
Share on other sites

Thank's for the replies. Did what you said and it compiled fine, but still didnt seem to Loop the MouseClick event when it was running. Held the mouse over an icon, held the left click down to check if the Loop was working which seemed to fail.

Any idea where i'm going wrong?

Share this post


Link to post
Share on other sites

Thank's for the replies. Did what you said and it compiled fine, but still didnt seem to Loop the MouseClick event when it was running. Held the mouse over an icon, held the left click down to check if the Loop was working which seemed to fail.

Any idea where i'm going wrong?

When you did what the last poster said then I would say the script doesn't make much sense any more.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank's for the replies. Did what you said and it compiled fine, but still didnt seem to Loop the MouseClick event when it was running. Held the mouse over an icon, held the left click down to check if the Loop was working which seemed to fail.

Any idea where i'm going wrong?

You do a MouseDown("Left") while you are already pressing left mouse button ( _IsPressed("01") ) ... Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#10 ·  Posted

These lines will not run:

MouseDown("Left")

Sleep(10)

MouseUp("Left")

Because above those lines you have a continueloop


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

#12 ·  Posted

may be like this ?

While 1
    Sleep(10)
    If _IsPressed("02") Then
        MouseDown("Left")
        ConsoleWrite ( 'MouseDown("Left")' & @Crlf )
        Sleep(10)
        MouseUp("Left")
        ConsoleWrite ( 'MouseUp("Left")' & @Crlf )
    EndIf
WEnd

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#13 ·  Posted

may be like this ?

While 1
    Sleep(10)
    If _IsPressed("02") Then
        MouseDown("Left")
        ConsoleWrite ( 'MouseDown("Left")' & @Crlf )
        Sleep(10)
        MouseUp("Left")
        ConsoleWrite ( 'MouseUp("Left")' & @Crlf )
    EndIf
WEnd

As @Jos has mentioned, it makes little sense but it works well!!!

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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