Jump to content

GUI Newbie


savj14
 Share

Recommended Posts

I'm not sure if this is classified for GUI or not but I am having trouble looping within the GUI.

I want to check to make sure Text has been Entered and it doesn't seem to be working correctly. If I don;t enter text a Msgbox will appear but never go away. If I do enter text the same Msgbox will appear and then continue on.

Here is my code.........Any suggestions??? I am going to eventually want to check for blank Username input as well as make sure a machine type radio button is selected. I suppose the checking can be done before I hit the Join Domain button........which ever way makes most sense.........I can't figure it out though

Here is my code:

#include <GUIConstants.au3>

$password = ("keane123")
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)
$Label17 = GUICtrlCreateLabel("Created by - ", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Select 
        Case $nMsg =-3
            ExitLoop
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
        Case $nMsg=$joindomain
            Do 
            MsgBox(1, "Error", "Please Enter Your Portal ID")
            GUISetState(@SW_SHOW)
            Until GuiCtrlRead($portal) <> ""
            MsgBox(1, "Results", GuiCtrlRead($username) & "" & $machinetype)        
        ExitLoop
    
        EndSelect
WEnd
Edited by savj14
Link to comment
Share on other sites

While 1
    $nMsg = GUIGetMsg()
    Select 
        Case $nMsg =-3
            ExitLoop
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
        Case $nMsg=$joindomain
            If GuiCtrlRead($portal) = "" Then
                MsgBox(1, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
                        MsgBox(1, "Results", GuiCtrlRead($username) & "" & $machinetype) 
                ExitLoop
        EndSelect
WEnd

Link to comment
Share on other sites

Thanks that worked like a charm

Now my question is how do make sure that a radio button is selected as well. That way I will have checks for username, portal id, and that a radio button is selected

#include <GUIConstants.au3>

$password = ("keane123")
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)
$Label17 = GUICtrlCreateLabel("Created by - ", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Select 
        Case $nMsg =-3
            ExitLoop
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
        Case $nMsg=$joindomain  
            If GuiCtrlRead($username) = "" Then
                MsgBox(1, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(1, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
              MsgBox(1, "Results", GuiCtrlRead($username) & "" & $machinetype) 
          ExitLoop
        EndSelect
    WEnd
Edited by savj14
Link to comment
Share on other sites

Look in the helpfile for GuiCtrlSetState()

You'll probably want to use something like GuiCtrlSetState($the control, $GUI_CHECKED)

Ok I took a peek at the Help file and it will give me a msgbox if both are unchecked. But if I select either Radio button it will still give me a msgbox when it is not supposed to.........I think I am missing something

#include <GUIConstants.au3>

;Gui Code Starts Here

;Instruction Tab
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

;Tab One - Username
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)

;Tab Two - Portal ID
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

;Laptop Radio Button
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Desktop Radio Button
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Tab Three - Joining the Domain
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")

;Join Domain, Cancel, Help Buttons
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

;Progrss Bar
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)

;Created By Footer
$Label17 = GUICtrlCreateLabel("Created by - ", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
;Gui Code Ends Here

;Variables
$password = ("keane123")

While 1
    $nMsg = GUIGetMsg()
    Select 
        Case $nMsg =-3
            ExitLoop
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
        Case $nMsg=$joindomain  
            If GuiCtrlRead($username) = "" Then
                MsgBox(1, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf   
            If GuiCtrlRead($username) = "" Then
                MsgBox(1, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(1, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
            If GuiCtrlSetState($laptop, $GUI_UNCHECKED) And GuiCtrlSetState($desktop, $GUI_UNCHECKED) Then
                MsgBox(1, "Error", "Please Select a Machine Type")
                ContinueLoop
            EndIf
              MsgBox(1, "Results", "Your Username is " &GuiCtrlRead($username))
              MsgBox(1, "Results", "Your Computername is " &"K212-"&GuiCtrlRead($portal)&($machinetype))
          ExitLoop
        EndSelect
    WEnd
Edited by savj14
Link to comment
Share on other sites

Ok I took a peek at the Help file and it will give me a msgbox if both are unchecked. But if I select either Radio button it will still give me a msgbox when it is not supposed to.........I think I am missing something

The problem was I understood your question wrong the first time. You can use GuiCtrlSetState() to set a radio to checked or not checked, but you use GuiCtrlRead() to see if it is checked or not. This code should work fine...

#include <GUIConstants.au3>

;Gui Code Starts Here

;Instruction Tab
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

;Tab One - Username
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)

;Tab Two - Portal ID
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

;Laptop Radio Button
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Desktop Radio Button
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Tab Three - Joining the Domain
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")

;Join Domain, Cancel, Help Buttons
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

;Progrss Bar
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)

;Created By Footer
$Label17 = GUICtrlCreateLabel("Created by - .....", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
;Gui Code Ends Here

;Variables
$password = ("keane123")

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg =-3
            ExitLoop
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
        Case $nMsg=$joindomain 
            If GuiCtrlRead($username) = "" Then
                MsgBox(1, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf   
            If GuiCtrlRead($username) = "" Then
                MsgBox(1, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(1, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
            If GuiCtrlRead($laptop) = $GUI_UNCHECKED And GuiCtrlRead($desktop) = $GUI_UNCHECKED Then
                MsgBox(1, "Error", "Please Select a Machine Type")
                ContinueLoop
            EndIf
              MsgBox(1, "Results", "Your Username is " &GuiCtrlRead($username))
              MsgBox(1, "Results", "Your Computername is " &"K212-"&GuiCtrlRead($portal)&($machinetype))
          ExitLoop
        EndSelect
    WEnd
Edited by JdeB
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

That did the trick.........I am learning a lot thanks for the help......My Error checking is almost complete.

Is there a way to do some error checking to make sure that a user enters only Alpha numberical data?? I will also need to make sure only Numerical data is entered as well. I looked in the Help File but didn't know where exactly to look.

Link to comment
Share on other sites

Try looking up the StringIsAlNum() function. :)

EDIT: Btw there is an index in the help file if you just type String it will go right to the string functions.

Ok so I am trying to do some checking and can't seem to get it to work properly..........Here is what I came up with after looking at the example

$CHK = StringIsAlpha($username)
If $CHK=0 Then
MsgBox(1, "Error", "Username Cannot Contain Numbers")

It doesn't seem to be checking to see if is Alpha Numerical.........I typed in some numbers and it didn't give me an error message

Link to comment
Share on other sites

Ok so I am trying to do some checking and can't seem to get it to work properly..........Here is what I came up with after looking at the example

$CHK = StringIsAlpha($username)
If $CHK=0 Then
MsgBox(1, "Error", "Username Cannot Contain Numbers")oÝ÷ Ø]¡ë'ßÛlyé­¡·ç$x-¢Çø¬ZahÛ¦z¸jR-Ê{(éî·«±©Ý×bv}ý¶¯zgê뢹²Æ {ú®¢×"(èÓM4[)j{-ÊW

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Ok I have the Check working perfectly for the username. If it contains Numeric input it will continue to loopback unitl Aplha numeric input is entered.

I applied the same to check for the portal id, which should contain all numeric. But, it will except any input......It doesn't make much sense. Considering I am using the exact same way to check.

Anyone see why this is not working??

#include <GUIConstants.au3>
#NoTrayIcon 

;Gui Code Starts Here

;Instruction Tab
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

;Tab One - Username
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)

;Tab Two - Portal ID
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

;Laptop Radio Button
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Desktop Radio Button
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Tab Three - Joining the Domain
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")

;Join Domain, Cancel, Help Buttons
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Cancel = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Help = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

;Progrss Bar
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)

;Created By Footer
$Label17 = GUICtrlCreateLabel("Created by - ", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
;Gui Code Ends Here

;Variables
    $password = ("keane123")
    $domain = ("Domain")

While 1
    $nMsg = GUIGetMsg()
    Select 
;When User Hits the X on Gui
        Case $nMsg =-3
            ExitLoop
;When User Hits Cancel Button
        Case $nMsg = $Cancel    
            ExitLoop
;When User Selects either Desktop or Laptop. It converts Laptop to letter L and Dektop to letter D
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
;Error checking before Joining the Domain. Makes sure all fields are valid
        Case $nMsg=$joindomain  
            If GuiCtrlRead($username) = "" Then
                MsgBox(0, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
            $CHK = StringIsAlpha(GuiCtrlRead ($username))
            If $CHK = 0 Then
                MsgBox(0, "Error", "Your Username Cannot Contain Numbers. Please Try Again.")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(0, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
            $CHK2 = StringIsAlNum(GuiCtrlRead ($portal))
            If $CHK2 = 0 Then
                MsgBox(0,"Error", "Your Portal ID Cannot Contain Letters. Please Try Again.")
                ContinueLoop
            EndIf           
            If GuiCtrlRead($laptop) = $GUI_UNCHECKED And GuiCtrlRead($desktop) = $GUI_UNCHECKED Then
                MsgBox(0, "Error", "Please Select a Machine Type")
                ContinueLoop
            EndIf
;Code for Adding User to Domain after all Error checking has been done
              MsgBox(1, "Results", "Your Username is " &GuiCtrlRead($username))
              MsgBox(1, "Results", "Your Computername is " &"K212-"&GuiCtrlRead($portal)&($machinetype))
          ExitLoop
        EndSelect
    WEnd
Edited by savj14
Link to comment
Share on other sites

Maybe you're using the wrong function:

Msgbox(0, 'Result', StringIsAlNum('a2a34z5a'))

At least on my computer it says that 'a3a44z5a' is all numbers...

Either we're all misunderstanding what "alphanumeric characters" are or this is a bug...

EDIT: Ahh... this would help:

alphanumeric

In computers designed for English language users, alphanumeric (sometimes seen as alphameric) characters are those comprised by the combined set of the 26 alphabetic characters, A to Z, and the 10 Arabic numerals, 0 to 9. In some usages, the alphanumeric character set may include both upper and lower case letters, punctuation marks, and symbols (such as @, &, and *, for example). For languages other than English, alphanumeric characters include letter variations such as é and ç. For some computer usages, such as file naming, alphanumeric characters are strictly limited to the 26 alphabetic characters and 10 numerals; however, for other usages, such as programming, other keyboard symbols are sometimes permitted.

From here. Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

You needed StringIsDigit()

#include <GUIConstants.au3>
#NoTrayIcon

;Gui Code Starts Here

;Instruction Tab
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

;Tab One - Username
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)

;Tab Two - Portal ID
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

;Laptop Radio Button
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Desktop Radio Button
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Tab Three - Joining the Domain
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")

;Join Domain, Cancel, Help Buttons
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Cancel = GUICtrlCreateButton("&Cancel", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Help = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

;Progrss Bar
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)

;Created By Footer
$Label17 = GUICtrlCreateLabel("Created by - .........", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
;Gui Code Ends Here

;Variables
    $password = ("keane123")
    $domain = ("Domain")

While 1
    $nMsg = GUIGetMsg()
    Select
;When User Hits the X on Gui
        Case $nMsg =-3
            ExitLoop
;When User Hits Cancel Button
        Case $nMsg = $Cancel   
            ExitLoop
;When User Selects either Desktop or Laptop. It converts Laptop to letter L and Dektop to letter D
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
;Error checking before Joining the Domain. Makes sure all fields are valid
        Case $nMsg=$joindomain 
            If GuiCtrlRead($username) = "" Then
                MsgBox(0, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
            $CHK = StringIsAlpha(GuiCtrlRead ($username))
            If $CHK = 0 Then
                MsgBox(0, "Error", "Your Username Cannot Contain Numbers. Please Try Again.")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(0, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
            $CHK2 = StringIsDigit(GuiCtrlRead ($portal))
            If $CHK2 = 0 Then
                MsgBox(0,"Error", "Your Portal ID Cannot Contain Letters. Please Try Again.")
                ContinueLoop
            EndIf        
            If GuiCtrlRead($laptop) = $GUI_UNCHECKED And GuiCtrlRead($desktop) = $GUI_UNCHECKED Then
                MsgBox(0, "Error", "Please Select a Machine Type")
                ContinueLoop
            EndIf
;Code for Adding User to Domain after all Error checking has been done
              MsgBox(1, "Results", "Your Username is " &GuiCtrlRead($username))
              MsgBox(1, "Results", "Your Computername is " &"K212-"&GuiCtrlRead($portal)&($machinetype))
          ExitLoop
        EndSelect
    WEnd
Edited by JdeB
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Very Nice..........You know I looked across that and never thought about using it.......Thanks for the help.......it appears to be working perfectly now

Now on to my next issue I am trying to created a Confirmation On the Exit. If I select Yes when asked Am I Sure to Exit.....It will Exit........If I say No........The GUI Will just Stay Hidden........Any clue??

#include <GUIConstants.au3>
#NoTrayIcon 

;Change Domain and Password Here
$domain = ("Domain")
$password = ("keane123")

;Gui Code Starts Here

;Instruction Tab
$dlgTabbed = GUICreate("Keane - Join Domain Tool", 483, 346, 262, 185)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 460, 256)
$Instructions = GUICtrlCreateTabItem("Instructions")
$Label1 = GUICtrlCreateLabel("The Following Step will guide you through joining the Keane Domain", 24, 40, 337, 48)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Please complete each of the steps completely and in the proper order", 24, 120, 281, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("If at any point you need help please refer to the Help Button, located in the bottom right corner", 24, 176, 357, 44)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)

;Tab One - Username
$Step_One = GUICtrlCreateTabItem("Step One - Username")
$username=GUICtrlCreateInput("", 152, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Your Username Here")
$Label5 = GUICtrlCreateLabel("Username:", 72, 72, 79, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Example: jdoe", 152, 96, 70, 17)
GUICtrlSetColor(-1, 0x0000FF)
$Label8 = GUICtrlCreateLabel("** Your Username will be the First Inital of your First Name followed by your Full Last Name.", 16, 200, 401, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label9 = GUICtrlCreateLabel("** Your Username will be in all LOWER CASE.", 16, 232, 264, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label10 = GUICtrlCreateLabel("Quick Hints", 14, 168, 111, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)

;Tab Two - Portal ID
$Step_Two = GUICtrlCreateTabItem("Step Two - Portal ID")
$Label6 = GUICtrlCreateLabel("Portal ID:", 18, 75, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$portal = GUICtrlCreateInput("", 88, 72, 121, 21)
GUICtrlSetTip(-1, "Enter Portal ID Here")
$Label11 = GUICtrlCreateLabel("Select Your Machine Type:", 19, 114, 190, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

;Laptop Radio Button
$laptop = GUICtrlCreateRadio("Laptop", 32, 152, 73, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Desktop Radio Button
$desktop = GUICtrlCreateRadio("Desktop", 117, 152, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)

;Tab Three - Joining the Domain
$Step_Three = GUICtrlCreateTabItem("Step Three - Join the Domain")
$Label12 = GUICtrlCreateLabel("Please make sure your Username and Portal ID are both typed in correctly.", 24, 64, 355, 17)
$Label13 = GUICtrlCreateLabel("Please make sure that you have selected the correct Machine Type.", 24, 88, 327, 17)
$Label14 = GUICtrlCreateLabel("You can now Press the", 40, 136, 167, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Join Domain", 208, 136, 103, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label16 = GUICtrlCreateLabel("button.", 312, 136, 54, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateTabItem("")

;Join Domain, Exit, Help Buttons
$joindomain = GUICtrlCreateButton("&Join Domain", 214, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Exit = GUICtrlCreateButton("&Exit", 302, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Help = GUICtrlCreateButton("&Help", 392, 280, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

;Progrss Bar
$Progress1 = GUICtrlCreateProgress(8, 304, 150, 16)
GUICtrlSetData(-1, 25)
$Label4 = GUICtrlCreateLabel("Your Progress", 8, 272, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x00FF00)

;Created By Footer
$Label17 = GUICtrlCreateLabel("Created by - ", 256, 320, 168, 20)
GUICtrlSetFont(-1, 10, 800, 2, "Bookman Old Style")
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
;Gui Code Ends Here

;This is the magic behind the nice looking GUI
While 1
    $nMsg = GUIGetMsg()
    Select 
;When User Hits the X on Gui
        Case $nMsg =-3
            ExitLoop
;When User Hits Cancel Button
        Case $nMsg = $Exit
;Show Message Box To Confirm Yes or No on Exit
            GUISetState(@SW_HIDE)
            $Confirm = MsgBox(4,"Exit", "Are You Sure You Want to Exit?")
                If $Confirm = 6 Then
                    ExitLoop
            GUISetState(@SW_SHOW)
            ContinueLoop
            EndIf
;When User Selects either Desktop or Laptop. It converts Laptop to letter L and Dektop to letter D
        Case $nMsg = $laptop And BitAND(GUICtrlRead($laptop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("L")
        Case $nMsg = $desktop And BitAND(GUICtrlRead($desktop), $GUI_CHECKED) = $GUI_CHECKED
            $machinetype=("D")
;Error checking before Joining the Domain. Makes sure all fields are valid
        Case $nMsg=$joindomain  
            If GuiCtrlRead($username) = "" Then
                MsgBox(0, "Error", "Please Enter Your Username")
                ContinueLoop
            EndIf
;Do a check to make sure the Username is using all Alphanumeric input. No Numbers Please =)         
            $CHK = StringIsAlpha(GuiCtrlRead ($username))
            If $CHK = 0 Then
                MsgBox(0, "Error", "Your Username Cannot Contain Numbers. Please Try Again.")
                ContinueLoop
            EndIf
            If GuiCtrlRead($portal) = "" Then
                MsgBox(0, "Error", "Please Enter Your Portal ID")
                ContinueLoop
            EndIf
;Do a check to make sure the Portal ID is using all Numeric input. No Letters Please =)
            $CHK2 = StringIsDigit(GuiCtrlRead ($portal))
            If $CHK2 = 0 Then
                MsgBox(0,"Error", "Your Portal ID Cannot Contain Letters. Please Try Again.")
                ContinueLoop
            EndIf           
            If GuiCtrlRead($laptop) = $GUI_UNCHECKED And GuiCtrlRead($desktop) = $GUI_UNCHECKED Then
                MsgBox(0, "Error", "Please Select a Machine Type")
                ContinueLoop
            EndIf
;Code for Adding User to Domain after all Error checking has been done
              MsgBox(1, "Results", "Your Username is " &GuiCtrlRead($username))
              MsgBox(1, "Results", "Your Computername is " &"K212-"&GuiCtrlRead($portal)&($machinetype))
          ExitLoop
        EndSelect
    WEnd
Edited by savj14
Link to comment
Share on other sites

I would do a message box... something like this:

$pass = Msgbox(4, '<insert program name>', 'Are you sure you want to exit?')
Then $pass would be 6 if the user pressed Yes and 7 if the user pressed no
This is what I have and it doesn't want to show the GUI again if I selected NO

GUISetState(@SW_HIDE)
            $Confirm = MsgBox(4,"Exit", "Are You Sure You Want to Exit?")
                If $Confirm = 6 Then
                    ExitLoop
            GUISetState(@SW_SHOW)
            ContinueLoop
            EndIf
Link to comment
Share on other sites

This is what I have and it doesn't want to show the GUI again if I selected NO

GUISetState(@SW_HIDE)
            $Confirm = MsgBox(4,"Exit", "Are You Sure You Want to Exit?")
                If $Confirm = 6 Then
                    ExitLoop
            GUISetState(@SW_SHOW)
            ContinueLoop
            EndIfoÝ÷ Ûú®¢×êÞßÛ'¢«¨´Ilz«¨¶ËZµéÛ(¶¥¢b±ìb¶)àmçè­è­­æë-ç(è]4[)j{-ÊW

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

That did the trick.......I figured I was close..... Thanks for the help

Now, I would also like to run a couple of Registry Imports. Is this possible??

Also, lets say I want to use a few Graphics/Icons on my GUI. If I Covert the script to EXE will these Files have to be on the computer I am running the script on? So for each User that uses this script, will they have to have the graphics file on their machines or will it be embedded when converting to EXE?

Is there a way to package everything up?

Link to comment
Share on other sites

That did the trick.......I figured I was close..... Thanks for the help

Now, I would also like to run a couple of Registry Imports. Is this possible??

No prob - As for registry imports, you can use RegWrite (syntax and such in the help file) as long as the user running the script has rights to do so.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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