Jump to content
Sign in to follow this  

GUICtrlSetOnEvent what to put in function

Recommended Posts


I created a script with a simple GUI that only contains some labels and a Cancel button. The Script updates software on a PC and signs-on to an application. I am using the GUIOnEventMode because I want the user to be able to press Cancel at any time to exit. This all works fines.

I pass in a UserID as a command line parameter to the script. But, if the userid is missing I create an GUI Edit control & OK button on the screen to allow the user to enter a UserID and continue. If they don't enter anything I want the script to exit after 15 seconds.

Here is where I get confused. I plan to have a loop to wait the 15 seconds to see if the user enters a Userid and presses OK. How do I know to exit this loop when the OK button is pressed?

I will create a function that is performed when the user presses the OK button. I will enter the function name on my GUICtrlSetOnEvent line. But, I don't really need to do anything in the function. I just need to know the user pressed OK.

Share this post

Link to post
Share on other sites

Try an Inputbox instead, it might make things a LOT easier for you that way.

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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.