Jump to content

Recommended Posts

Posted

This is my first GUI script and I'm can't figure out how to eliminate the "undefined function" error in line 19.  I want the form to close after a radio button selection is made or after a user presses the OK button.

$Form1_1 = GUICreate("Tools Form", 538, 336, 395, 262)
$Group1 = GUICtrlCreateGroup("All Tools", 39, 108, 307, 170)
$Radio1 = GUICtrlCreateRadio("First Tool", 59, 147, 139, 21)
$Radio2 = GUICtrlCreateRadio("Second Tool", 57, 188, 140, 21)
$Radio3 = GUICtrlCreateRadio("Third Tool", 59, 227, 139, 21)
$Icon1 = GUICtrlCreateIcon("C:\Tool.ico", -1, 287, 128, 48, 48)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$OKID = GUICtrlCreateButton("OK", 373, 190, 92, 31)
$Label1 = GUICtrlCreateLabel("Please Choose Tool", 39, 30, 373, 36)
GUICtrlSetFont(-1, 16, 400, 0, "Arial Rounded MT Bold")
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            Case $Radio1
            OnFirstTool()
            GUIDelete(Form1_1)
            Exit
            Case $Radio2
            OnSecondTool()
            GUIDelete(Form1_1)
            Exit
            Case $Radio3
            OnThirdTool()
            GUIDelete(Form1_1)
            Exit
        Case $OKID
            Exit
    EndSwitch
WEnd
Func OnWinTool()
    Run("E:\FirstApp.exe")
EndFunc   
Func OnXapp()
    Run("D:\SecondApp.exe")
    EndFunc   
Func OnDism()
    Run("F:\ThirdApp.exe")
EndFunc

 

 

Posted (edited)

1.  #include <GUIConstantsEx.au3> not declared

2. Your function names do not match the Switch statements. Eg, OnFirstTool() -> OnWinTool()

3. You have omitted the "$" prefix on variables in the GuiDelete(Form1_1) statements. Should be GuiDelete($Form1_1)

Fix all that and it runs without error.

Edited by pseakins

Phil Seakins

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
×
×
  • Create New...