muzle6074 Posted May 17, 2008 Posted May 17, 2008 Hi everyone! This my first GUI app using au3 so any help is appreciated! I just have 3 questions... 1. If you execute a button which contains an endless loop, is there a way to break the cycle so you can pause or exit? 2. How can you add text to a listbox so each new entry goes on a new line and if it exceeds the width of the listbox then it goes to a new line? 3. How do I go about enabling a vertical scroll bar? Below is sum sample code of my endless loop problem, I want to be able to break the cycle when another button is clicked(if this is possible). Regards - Alex #include <GUIConstants.au3> #include <Array.au3> GUICreate("+1", 400, 300) GUISetState(@SW_SHOW) $btn_Run = GUICtrlCreateButton("Run", 10, 10, 100, 25) $btn_Pause = GUICtrlCreateButton("Pause", 10, 45, 100, 25) $btn_Exit = GUICtrlCreateButton("Exit", 10, 80, 100, 25) $lst_Status = GUICtrlCreateList("", 125, 10, 200, 250) Global $Pause While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $btn_Exit Exit Case $msg = $btn_Pause $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") Case $msg = $btn_Run While 1; endless loop ; do some code WEnd EndSelect WEnd
BrettF Posted May 17, 2008 Posted May 17, 2008 Q1- Yes it is possible to break a loop externally. 1 method would be to have a varible, and set it to true/false depending on what you want done in the loop. If you add if $var = true then ExitLoop into your loop, it will exit the loop if $var is true. Also, if you don't already use AdLib in your GUI, you can just use an adlib loop, which would be easy. Q2- Well a simple function could do that. Q3- Look in the helpfile for scroll. Should be under UDF's (Latest version from memory) Give me a bit to get AutoIt back on this stupid loan machine, and I'll get one working for you Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
muzle6074 Posted May 17, 2008 Author Posted May 17, 2008 Thank you Bert! Many thanks, ill keep a watch on this thread and implement ur resolution for q1 now
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now