Jump to content
Sign in to follow this  

Need help with GUI portion of this script.

Recommended Posts


Hi guys,

I'm trying to learn to write scripts with AutoIt and have come to a problem which I've been unable to understand. I'm hoping that one of you might be able to point out where my script (test1.au3) is failing and explain to me why it fails.

The GUI part of this script doesn't seem to function properly for me. When I Beta Run lines 27 to 46 as a stand-alone script (test2.au3), all goes well, but when I try to intergrate it into the script as a function, it seems to be stuck in a loop.

Any help would be greatly appreciated, thanks.


Share this post

Link to post
Share on other sites

I'm sorry, but i dont see what you're trying to accomplish... you have your function (_UserInput) which you're never calling, so all this script is going to do is sleep until it is terminated, please explain further what you're trying to do


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post

Link to post
Share on other sites


that command box sure look familiar... *0


I prefer to create the gui... then set the hotkey to show the gui


#include <GuiConstants.au3>
Dim $gui, $Button_OK
AutoItSetOption("OnExitFunc", "_Terminate")

While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $Button_OK

Func _SetHotKeys()
    HotKeySet("{PAUSE}", "_UserInput")
EndFunc ;==>_SetHotKeys

Func _Terminate()
    AutoItSetOption("OnExitFunc", "OnAutoItExit")
    Exit 0
EndFunc ;==>_Terminate

Func _UserInput()
    $command = InputBox("Command Input", "Input your command here.", "", "", 10, 10, 400, 613, 20)
    If $command = "Exit" Then _Terminate()
    If $command = "Test" Then _UserInput1()
EndFunc ;==>_UserInput

Func _UserInput1()
    $gui = GUICreate("Command Window", 392, 323, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $Checkbox_1 = GUICtrlCreateCheckbox("Checkbox1", 40, 30, 80, 20)
    $Checkbox_2 = GUICtrlCreateCheckbox("Checkbox2", 40, 70, 80, 10)
    $Checkbox_3 = GUICtrlCreateCheckbox("Checkbox3", 40, 110, 80, 10)
    $Checkbox_4 = GUICtrlCreateCheckbox("Checkbox4", 40, 140, 80, 10)
    $Button_OK = GUICtrlCreateButton("OK", 20, 290, 80, 30)
    $Button_Cancel = GUICtrlCreateButton("Cancel", 280, 290, 80, 30)
EndFunc ;==>_UserInput1


Edited by Valuater


Share this post

Link to post
Share on other sites

Thank you so much, Valuater.

Your suggestion worked perfectly.

:o The GUI box was made using the GUIBuilder in SciTE. I'm just trying to make a lot of small scripts to learn how to use AutoIt.

Again, thanks for the prompt reply and helpful advice.


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