Sign in to follow this  
Followers 0
atnextc

Script "cleanup" and check box questions

1 post in this topic

#1 ·  Posted (edited)

Below is my code. I have run into a few problems.

1. When you click on checkbox next to exit a small "thing" shows up to the right of it. I have tried deleting and recreating this check box in Koda but it still shows up and its the only one that does it.

2. When I take out all the stuff about Case $btnok, then the menu msgbox's work as they are supposed to, as well as the exit option under file. The way that it is now they will not work.

3. I managed to get it to where when you click on OK button and no check boxes are selected that it will MSgbox you telling you to select an option. However, when I applied the same principal to have it popup a msgbox if more than one was selected it doesn't work the way I want it to. It just msgbox's that "the selected script will now be run which is not what I want it to do.

4. If i'm wanting to have a "long list" of stuff happen for each option is it best to make that option its own .au3 then have it called via the button or is it wise to just leave it all in one script?

5. General script clean up advice as I'm sure it can be much better, "and I haven't even started on the "real meat" of this thing either."

Thanks in advance for any help in these matters >_<

#comments-start
    This script will launch a GUI asking what you want to do
    1. Login to CRM
    2. Close an open Case
    3. Close an alert
    4. Create a new case for MSS
    5. Exit
    
    Written by atnextc
    July 30th 2009
#comments-end

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\atnextc\Documents\CRM AutoIT Scripts\VIA.kxf
$nMSG = GUICreate("VIA Networks CRM Helper", 547, 375, 192, 133)
$mnufile = GUICtrlCreateMenu("&File")
$mnuexit = GUICtrlCreateMenuItem("Exit", $mnufile)
$mnuhelp = GUICtrlCreateMenu("&Help")
$mnunone = GUICtrlCreateMenuItem("There Is None", $mnuhelp)
$mnuabout = GUICtrlCreateMenu("&About")
$mnucrm = GUICtrlCreateMenuItem("About CRM Helper", $mnuabout)
$Pic1 = GUICtrlCreatePic("C:\Users\atnextc\Documents\CRM AutoIT Scripts\vialogo.jpg", 168, 32, 249, 57, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$lbl1 = GUICtrlCreateLabel("1.", 160, 160, 13, 17)
$lbl2 = GUICtrlCreateLabel("2.", 160, 184, 13, 17)
$lbl3 = GUICtrlCreateLabel("3.", 160, 208, 13, 17)
$lbl4 = GUICtrlCreateLabel("4.", 160, 232, 13, 17)
$lblcrm = GUICtrlCreateLabel("Login To CRM", 184, 160, 73, 17)
$lblalert = GUICtrlCreateLabel("Close an Alert", 184, 184, 69, 17)
$lblclose = GUICtrlCreateLabel("Close a Case", 184, 208, 66, 17)
$lblcreate = GUICtrlCreateLabel("Create New Case", 184, 232, 87, 17)
$lbl5 = GUICtrlCreateLabel("5.", 160, 256, 13, 17)
$lblexit = GUICtrlCreateLabel("Exit", 184, 256, 21, 17)
$lbltitle = GUICtrlCreateLabel("Please Select An Option From The List Below", 176, 112, 218, 17)
$btnok = GUICtrlCreateButton("OK", 168, 304, 75, 25, $WS_GROUP)
$btnexit = GUICtrlCreateButton("Exit", 288, 304, 75, 25, $WS_GROUP)
$chkcrm = GUICtrlCreateCheckbox("", 288, 160, 17, 17)
$chkalert = GUICtrlCreateCheckbox("", 288, 184, 17, 17)
$chkclose = GUICtrlCreateCheckbox("", 288, 208, 17, 17)
$chkcreate = GUICtrlCreateCheckbox("", 288, 232, 17, 17)
$chkexit = GUICtrlCreateCheckbox("", 288, 256, 17, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Switch GUIGetMsg()
        Case $chkexit
            If GUICtrlRead($chkexit) = $GUI_CHECKED Then
                GUICtrlSetData($chkexit, 'Checked')
            Else
                GUICtrlSetData($chkexit, 'Unchecked')
            EndIf
        
            If $nMSG = $mnufile Then
                $mnufile = GUICtrlCreateMenuItem($mnufile, $mnuexit)
                Exit
            EndIf

            If $nMSG = $mnunone Then
                MsgBox(0, "CRM Helper", "Sorry There Is No Help!")
            EndIf

            If $nMSG = $GUI_EVENT_CLOSE Or $nMSG = $btnexit Or $nMSG = $mnuexit Then ExitLoop
            If $nMSG = $mnucrm Then MsgBox(0, "About CRM Helper", "Created by atnextc")
        
        Case $btnok
            $IsChecked = GUICtrlRead($chkexit) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkexit) = $GUI_UNCHECKED Then
            Else
                Exit
            EndIf
            $IsChecked = GUICtrlRead($chkalert) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkalert) = $GUI_UNCHECKED Then
            Else
                MsgBox(0, "CRM Helper", "This will close an alert in CRM!")
                Exit
            EndIf
            $IsChecked = GUICtrlRead($chkcrm) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkcrm) = $GUI_UNCHECKED Then
            Else
                MsgBox(0, "CRM Helper", "This will log you into CRM!")
                Exit
            EndIf
            $IsChecked = GUICtrlRead($chkclose) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkclose) = $GUI_UNCHECKED Then
            Else
                MsgBox(0, "CRM Helper", "This will close a case in CRM!")
                Exit
            EndIf

            $IsChecked = GUICtrlRead($chkcreate) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkcreate) = $GUI_UNCHECKED Then
            Else
                MsgBox(0, "CRM Helper", "This will create a new case in CRM!")
                Exit
            EndIf
            $IsChecked = GUICtrlRead($chkcreate) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkcreate) = $GUI_UNCHECKED Then
                $IsChecked = GUICtrlRead($chkclose) = $GUI_CHECKED
                ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                If GUICtrlRead($chkclose) = $GUI_UNCHECKED Then
                    $IsChecked = GUICtrlRead($chkcrm) = $GUI_CHECKED
                    ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                    If GUICtrlRead($chkcrm) = $GUI_UNCHECKED Then
                        $IsChecked = GUICtrlRead($chkexit) = $GUI_CHECKED
                        ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                        If GUICtrlRead($chkexit) = $GUI_UNCHECKED Then
                            $IsChecked = GUICtrlRead($chkalert) = $GUI_CHECKED
                            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                            If GUICtrlRead($chkalert) = $GUI_UNCHECKED Then
                                MsgBox(0, "CRM Helper", "Please Select An Option!")
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
            
            $IsChecked = GUICtrlRead($chkcreate) = $GUI_CHECKED
            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
            If GUICtrlRead($chkcreate) = $GUI_CHECKED Then
                $IsChecked = GUICtrlRead($chkclose) = $GUI_CHECKED
                ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                If GUICtrlRead($chkclose) = $GUI_CHECKED Then
                    $IsChecked = GUICtrlRead($chkcrm) = $GUI_CHECKED
                    ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                    If GUICtrlRead($chkcrm) = $GUI_CHECKED Then
                        $IsChecked = GUICtrlRead($chkexit) = $GUI_CHECKED
                        ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                        If GUICtrlRead($chkexit) = $GUI_CHECKED Then
                            $IsChecked = GUICtrlRead($chkalert) = $GUI_CHECKED
                            ConsoleWrite($IsChecked & ', ' & Hex($GUI_CHECKED) & @CRLF)
                            If GUICtrlRead($chkalert) = $GUI_CHECKED Then
                                MsgBox(0, "CRM Helper", "Please Select Only 1 Option!")
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        Case $GUI_EVENT_CLOSE
            Exit;Loop
    EndSwitch
WEnd
Edited by atnextc

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  
Followers 0