Jump to content

Need help with ExitLoop !


Recommended Posts

Hello,

I tried to use if function To check if Button is clicked But It doesnt' worked .. Because i wan't to use a button inside a Loop to exit ir !

let me show you the code :

$Stop = GUICtrlCreateButton("Stop", 219, 184, 123, 41)


For $x = 1 to $x = 100
MsgBox(0,"","TEST")

if $Stop then
ExitLoop
Endif
Next
;Some thing

I'v tried to use Case but i got an error message saying that "Case" statement with no matching "Select"or "Switch" statement.:

Edited by GoodBoy
Link to comment
Share on other sites

Goodboy,

please

Global $Gui = GUICreate("test", 400, 100)

Global $BtClose = GUICtrlCreateButton('Close', 10, 60, 85, 25)

GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $BtClose
ExitLoop

Case -3
ExitLoop

EndSwitch
WEnd
GUIDelete($Gui)
Exit

Because you are new to AutoIt.. next time try to use help

GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

There are many ways to achieve what you want, but none are quite as simple as you might hope.

First off, you must think about what you've done, logically.

At the very least, you need to add in some Sleeps, but that's just the start.

You also need to correct your code as you have an error in your 'For $x =' line.

You also need to look at getting the button ID ... use the Window Info Tool for that.

Then understanding the 'Adlib' function calls and probably incorporating them.

More often than not these days, I just use IniWrite and IniRead with a second dedicated EXE that is a simple floating GUI with a STOP button. I find that often works best and flawless. Obviously, when you click the STOP button, it writes to an INI file entry, which the other EXE regularly checks. You don't want it being checked any more often than about once every second or 500 millisecs though.

EDIT

GreenCan who posted meanwhile, has it right though, you need to study the Help file and become more familiar with what you are using and the logic of what you are trying to achieve. A good search here at the Forum, will also help you immensely.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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...