Jump to content

Need help with GUI portion of this script.


Ray
 Share

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.

Ray

Link to comment
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

~cdkid

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!
Link to comment
Share on other sites

1

that command box sure look familiar... *0

2

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

maybe

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

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete($gui)
        Case $msg = $Button_OK
            GUIDelete($gui)
    EndSelect
    WEnd

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

Func _Terminate()
    Sleep(20)
    AutoItSetOption("OnExitFunc", "OnAutoItExit")
    Sleep(20)
    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)
    
    GUISetState()
    
EndFunc ;==>_UserInput1

8)

Edited by Valuater

NEWHeader1.png

Link to comment
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.

Ray

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