Jump to content
Sign in to follow this  
m1975michael

Menu - Display Contents

Recommended Posts

m1975michael

I have created a couple of GUI pages but now I would like to use a menu system to display them in the main body of the form when one of them is selected.  I know I can use Koda to create the menu system but I am not sure how to display the contents under the menu when I select the item.  Any suggestions would be appreciated.  Thank You!

Share this post


Link to post
Share on other sites
water

I have used tabs. >ADAT is a good example how it could look like.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
m1975michael

Hello Water,

Those utilities look great but not exactly what I am looking for.  If I click on a sub-menu item I would like it displayed below in the form.

Share this post


Link to post
Share on other sites
water

Then maybe >GUIExtender (8written by Melba23) is the tool you are looking for.

It allows to extend a GUI, hide and display sections of a GUI etc.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
m1975michael

I have attached my GUI code.  I can get the different "views" to display but when "Uncheck" them they won't disappear.  Any help would be appreciated. 

#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

StartDisplay()

Func StartDisplay()
Global $hCEDForm = GUICreate("CED", 382, 290, 242, 160)
Global $File = GUICtrlCreateMenu("&File")
Global $Exit = GUICtrlCreateMenuItem("Exit", $File)
Global $Tools = GUICtrlCreateMenu("&Tools")
Global $ProfitCenter = GUICtrlCreateMenuItem("Profit Center", $Tools)
Global $RemoteAccess = GUICtrlCreateMenuItem("Remote Access", $Tools)
GUISetBkColor(0xA6CAF0)
GUISetState(@SW_SHOW)
EndFunc

While 1
    Local $nMsg = GUIGetMsg()
    If $nMsg = $ProfitCenter Then
        If BitAND(GUICtrlRead($ProfitCenter), $GUI_CHECKED) = $GUI_CHECKED Then
            GUICtrlSetState($ProfitCenter, $GUI_UNCHECKED)
            GUICtrlSetState(DisplayProfitCenterTools(), $GUI_HIDE)

        Else
            GUICtrlSetState($ProfitCenter, $GUI_CHECKED)
            GUICtrlSetState(DisplayProfitCenterTools(), $GUI_SHOW)
        EndIf
    EndIf
    If $nMsg = $RemoteAccess Then
        If BitAND(GUICtrlRead($RemoteAccess), $GUI_CHECKED) = $GUI_CHECKED Then
            GUICtrlSetState($RemoteAccess, $GUI_UNCHECKED)
            GUICtrlSetState(DisplayRemoteAccess(), $GUI_HIDE)
        Else
            GUICtrlSetState($RemoteAccess, $GUI_CHECKED)
            GUICtrlSetState(DisplayRemoteAccess(), $GUI_SHOW)
        EndIf
    EndIf
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func DisplayRemoteAccess()
    Global $Remote = GUICtrlCreateInput("", 75, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
EndFunc

Func DisplayProfitCenterTools()
    Global $hPCTools = GUICtrlCreateGroup("Profit Center Tools", 24, 16, 161, 241)
    Global $hLabelPCNum = GUICtrlCreateLabel("PC Number", 40, 40, 58, 17)
    Global $hPCNumInput = GUICtrlCreateInput("", 40, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    GUICtrlSetLimit(-1, 4)
    Global $hButtonCheckBoxStatus = GUICtrlCreateButton("Execute Checked Items", 40, 182, 125, 25)
    Global $hCheckboxPingPC = GUICtrlCreateCheckbox("Ping PC Gateway", 40, 92, 115, 25)
    Global $hCheckboxFortiWiFiWeb = GUICtrlCreateCheckbox("Forti WiFi Web Login", 40, 122, 115, 25)
    Global $hCheckboxFortiWiFiPutty = GUICtrlCreateCheckbox("Forti WiFi Putty Login", 40, 152, 115, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $hLableNetworkTools = GUICtrlCreateGroup("Network Tools", 200, 16, 161, 241)
    Global $hButtonPingIPInput = GUICtrlCreateButton("Ping IP Address", 216, 122, 125, 25)
    Global $hCheckboxClearIP = GUICtrlCreateCheckbox("Clear IP After Execution", 216, 92, 127, 25)
    Global $hLabelIPAddress = GUICtrlCreateLabel("IP Address", 216, 40, 58, 17)
    Global $hIPAddressInput = GUICtrlCreateInput("", 216, 59, 105, 21)
    GUICtrlSetLimit(-1, 15)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc

Share this post


Link to post
Share on other sites
Melba23

m1975michael,

Create all the controls intially and then hide/show them as required: ;)

#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

StartDisplay()

Func StartDisplay()

    Global $hCEDForm = GUICreate("CED", 382, 290, 242, 160)
    GUISetBkColor(0xA6CAF0)

    Global $File = GUICtrlCreateMenu("&File")
    Global $Exit = GUICtrlCreateMenuItem("Exit", $File)
    Global $Tools = GUICtrlCreateMenu("&Tools")
    Global $ProfitCenter = GUICtrlCreateMenuItem("Profit Center", $Tools)
    Global $RemoteAccess = GUICtrlCreateMenuItem("Remote Access", $Tools)

    Global $iStart_Tools = GUICtrlCreateDummy()
    Global $hPCTools = GUICtrlCreateGroup("Profit Center Tools", 24, 16, 161, 241)
    Global $hLabelPCNum = GUICtrlCreateLabel("PC Number", 40, 40, 58, 17)
    Global $hPCNumInput = GUICtrlCreateInput("", 40, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    GUICtrlSetLimit(-1, 4)
    Global $hButtonCheckBoxStatus = GUICtrlCreateButton("Execute Checked Items", 40, 182, 125, 25)
    Global $hCheckboxPingPC = GUICtrlCreateCheckbox("Ping PC Gateway", 40, 92, 115, 25)
    Global $hCheckboxFortiWiFiWeb = GUICtrlCreateCheckbox("Forti WiFi Web Login", 40, 122, 115, 25)
    Global $hCheckboxFortiWiFiPutty = GUICtrlCreateCheckbox("Forti WiFi Putty Login", 40, 152, 115, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $hLableNetworkTools = GUICtrlCreateGroup("Network Tools", 200, 16, 161, 241)
    Global $hButtonPingIPInput = GUICtrlCreateButton("Ping IP Address", 216, 122, 125, 25)
    Global $hCheckboxClearIP = GUICtrlCreateCheckbox("Clear IP After Execution", 216, 92, 127, 25)
    Global $hLabelIPAddress = GUICtrlCreateLabel("IP Address", 216, 40, 58, 17)
    Global $hIPAddressInput = GUICtrlCreateInput("", 216, 59, 105, 21)
    GUICtrlSetLimit(-1, 15)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $iEnd_Tools = GUICtrlCreateDummy()

    _Tools_Display(False)

    Global $iRemote_Start = GUICtrlCreateDummy()
    Global $Remote = GUICtrlCreateInput("", 75, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    Global $iRemote_End = GUICtrlCreateDummy()

    _Remote_Display(False)

    GUISetState(@SW_SHOW)

EndFunc   ;==>StartDisplay

Func _Tools_Display($fFlag)
    If $fFlag = True Then
        For $i = $iStart_Tools To $iEnd_Tools
            GUICtrlSetState($i, $GUI_SHOW)
        Next
    Else
        For $i = $iStart_Tools To $iEnd_Tools
            GUICtrlSetState($i, $GUI_HIDE)
        Next
    EndIf
EndFunc   ;==>_Tools_Display

Func _Remote_Display($fFlag)
    If $fFlag = True Then
        For $i = $iRemote_Start To $iRemote_End
            GUICtrlSetState($i, $GUI_SHOW)
        Next
    Else
        For $i = $iRemote_Start To $iRemote_End
            GUICtrlSetState($i, $GUI_HIDE)
        Next
    EndIf
EndFunc   ;==>_Remote_Display

While 1

    Switch GUIGetMsg()
        Case $ProfitCenter
            If BitAND(GUICtrlRead($ProfitCenter), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($ProfitCenter, $GUI_UNCHECKED)
                _Tools_Display(False)
            Else
                GUICtrlSetState($ProfitCenter, $GUI_CHECKED)
                _Tools_Display(True)
            EndIf
        Case $RemoteAccess
            If BitAND(GUICtrlRead($RemoteAccess), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($RemoteAccess, $GUI_UNCHECKED)
                _Remote_Display(False)
            Else
                GUICtrlSetState($RemoteAccess, $GUI_CHECKED)
                _Remote_Display(True)
            EndIf
            ;
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
All clear? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
BrewManNH

Here's my take on this. :)

#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $aDPCTools[13]
Global Enum $hPCTools, $hLabelPCNum, $hPCNumInput, $hButtonCheckBoxStatus, $hCheckboxPingPC, $hCheckboxFortiWiFiWeb, _
        $hCheckboxFortiWiFiPutty, $hLableNetworkTools, $hButtonPingIPInput, $hCheckboxClearIP, $hLabelIPAddress, _
        $hIPAddressInput, $Remote

StartDisplay()
DisplayProfitCenterToolsStartup()
DisplayProfitCenterTools(False)
DisplayRemoteAccess(False)
Func StartDisplay()
    Global $hCEDForm = GUICreate("CED", 382, 290, 242, 160)
    Global $File = GUICtrlCreateMenu("&File")
    Global $Exit = GUICtrlCreateMenuItem("Exit", $File)
    Global $Tools = GUICtrlCreateMenu("&Tools")
    Global $ProfitCenter = GUICtrlCreateMenuItem("Profit Center", $Tools)
    Global $RemoteAccess = GUICtrlCreateMenuItem("Remote Access", $Tools)
    GUISetBkColor(0xA6CAF0)
    GUISetState(@SW_SHOW)
EndFunc   ;==>StartDisplay

While 1
    Local $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $ProfitCenter
            If BitAND(GUICtrlRead($ProfitCenter), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($ProfitCenter, $GUI_UNCHECKED)
                DisplayProfitCenterTools(False)
            Else
                GUICtrlSetState($ProfitCenter, $GUI_CHECKED)
                DisplayProfitCenterTools(True)
            EndIf
        Case $RemoteAccess
            If BitAND(GUICtrlRead($RemoteAccess), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($RemoteAccess, $GUI_UNCHECKED)
                DisplayRemoteAccess(False)
            Else
                GUICtrlSetState($RemoteAccess, $GUI_CHECKED)
                DisplayRemoteAccess(True)
            EndIf
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func DisplayRemoteAccess($ShowState)
    If $ShowState Then
        GUICtrlSetState($aDPCTools[12], $gui_show)
    Else
        GUICtrlSetState($aDPCTools[12], $gui_HIDE)
    EndIf
EndFunc   ;==>DisplayRemoteAccess

Func DisplayProfitCenterTools($ShowState)
    If $ShowState Then
        For $I = 0 To 11
            GUICtrlSetState($aDPCTools[$I], $gui_show)
        Next
    Else
        For $I = 0 To 11
            GUICtrlSetState($aDPCTools[$I], $gui_HIDE)
        Next
    EndIf
EndFunc   ;==>DisplayProfitCenterTools
Func DisplayProfitCenterToolsStartup()
    $aDPCTools[0] = GUICtrlCreateGroup("Profit Center Tools", 24, 16, 161, 241)
    $aDPCTools[1] = GUICtrlCreateLabel("PC Number", 40, 40, 58, 17)
    $aDPCTools[2] = GUICtrlCreateInput("", 40, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    GUICtrlSetLimit(-1, 4)
    $aDPCTools[3] = GUICtrlCreateButton("Execute Checked Items", 40, 182, 125, 25)
    $aDPCTools[4] = GUICtrlCreateCheckbox("Ping PC Gateway", 40, 92, 115, 25)
    $aDPCTools[5] = GUICtrlCreateCheckbox("Forti WiFi Web Login", 40, 122, 115, 25)
    $aDPCTools[6] = GUICtrlCreateCheckbox("Forti WiFi Putty Login", 40, 152, 115, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $aDPCTools[7] = GUICtrlCreateGroup("Network Tools", 200, 16, 161, 241)
    $aDPCTools[8] = GUICtrlCreateButton("Ping IP Address", 216, 122, 125, 25)
    $aDPCTools[9] = GUICtrlCreateCheckbox("Clear IP After Execution", 216, 92, 127, 25)
    $aDPCTools[10] = GUICtrlCreateLabel("IP Address", 216, 40, 58, 17)
    $aDPCTools[11] = GUICtrlCreateInput("", 216, 59, 105, 21)
    GUICtrlSetLimit(-1, 15)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $aDPCTools[12] = GUICtrlCreateInput("", 75, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
EndFunc   ;==>DisplayProfitCenterToolsStartup

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
m1975michael

Thank you Melba23 that helped greatly and made sense.  I am running into another problem though.  In my full script I have a while loop that I am not sure  how to handle with the menu system.  I put it into a function to see if that would help me but It is breaks the menu system.  When I uncheck the Profit Center it no longer hides.  

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=CEDUtilv3.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
AutoItSetOption("MustDeclareVars", 1)
Global $iIPAddress, $iIPO1, $iIPO2, $iIPO3, $iIPO4
EmbedCreatePuttyDirectoryFile()
CreatePuttyDir_CopyPutty()

#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

StartDisplay()

Func StartDisplay()

    Global $hCEDForm = GUICreate("CED Help Desk Utility", 382, 290, 242, 160)
    GUISetBkColor(0xA6CAF0)

    Global $File = GUICtrlCreateMenu("&File")
    Global $Exit = GUICtrlCreateMenuItem("Exit", $File)
    Global $Tools = GUICtrlCreateMenu("&Tools")
    Global $ProfitCenter = GUICtrlCreateMenuItem("Profit Center", $Tools)
    Global $RemoteAccess = GUICtrlCreateMenuItem("Remote Access", $Tools)

    Global $iStart_Profit_Center = GUICtrlCreateDummy()
    Global $hPCTools = GUICtrlCreateGroup("Profit Center Tools", 24, 16, 161, 241)
    Global $hLabelPCNum = GUICtrlCreateLabel("PC Number", 40, 40, 58, 17)
    Global $hPCNumInput = GUICtrlCreateInput("", 40, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    GUICtrlSetLimit(-1, 4)
    Global $hButtonCheckBoxStatus = GUICtrlCreateButton("Execute Checked Items", 40, 182, 125, 25)
    Global $hCheckboxPingPC = GUICtrlCreateCheckbox("Ping PC Gateway", 40, 92, 115, 25)
    Global $hCheckboxFortiWiFiWeb = GUICtrlCreateCheckbox("Forti WiFi Web Login", 40, 122, 115, 25)
    Global $hCheckboxFortiWiFiPutty = GUICtrlCreateCheckbox("Forti WiFi Putty Login", 40, 152, 115, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $hLableNetworkTools = GUICtrlCreateGroup("Network Tools", 200, 16, 161, 241)
    Global $hButtonPingIPInput = GUICtrlCreateButton("Ping IP Address", 216, 122, 125, 25)
    Global $hCheckboxClearIP = GUICtrlCreateCheckbox("Clear IP After Execution", 216, 92, 127, 25)
    Global $hLabelIPAddress = GUICtrlCreateLabel("IP Address", 216, 40, 58, 17)
    Global $hIPAddressInput = GUICtrlCreateInput("", 216, 59, 105, 21)
    GUICtrlSetLimit(-1, 15)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $iEnd_Profit_Center = GUICtrlCreateDummy()

    _Profit_Center_Display(False)

    Global $iRemote_Start = GUICtrlCreateDummy()
    Global $Remote = GUICtrlCreateInput("", 75, 59, 31, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
    Global $iRemote_End = GUICtrlCreateDummy()

    _Remote_Display(False)

    GUISetState(@SW_SHOW)

EndFunc   ;==>StartDisplay

Func _Profit_Center_Display($fFlag)
    If $fFlag = True Then
        For $i = $iStart_Profit_Center To $iEnd_Profit_Center
            GUICtrlSetState($i, $GUI_SHOW)
        Next
    Else
        For $i = $iStart_Profit_Center To $iEnd_Profit_Center
            GUICtrlSetState($i, $GUI_HIDE)
        Next
    EndIf
EndFunc   ;==>_Profit_Center_Display

Func _Remote_Display($fFlag)
    If $fFlag = True Then
        For $i = $iRemote_Start To $iRemote_End
            GUICtrlSetState($i, $GUI_SHOW)
        Next
    Else
        For $i = $iRemote_Start To $iRemote_End
            GUICtrlSetState($i, $GUI_HIDE)
        Next
    EndIf
EndFunc   ;==>_Remote_Display

While 1

    Switch GUIGetMsg()
        Case $ProfitCenter
            If BitAND(GUICtrlRead($ProfitCenter), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($ProfitCenter, $GUI_UNCHECKED)
                _Profit_Center_Display(False)
            Else
                GUICtrlSetState($ProfitCenter, $GUI_CHECKED)
                _Profit_Center_Display(True)
                PCLoop()
            EndIf
        Case $RemoteAccess
            If BitAND(GUICtrlRead($RemoteAccess), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($RemoteAccess, $GUI_UNCHECKED)
                _Remote_Display(False)
            Else
                GUICtrlSetState($RemoteAccess, $GUI_CHECKED)
                _Remote_Display(True)
            EndIf
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func PCLoop()
    _WinAPI_SetFocus(ControlGetHandle("CED Help Desk Utility", "", $hPCNumInput))
    While 1
        Local $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $hButtonPingIPInput
                PingIPInput()
            Case $hButtonCheckBoxStatus
                GetPCNumber()
                CheckBoxStatus()
        EndSwitch

        Local $aCursorInfo = GUIGetCursorInfo($hCEDForm)
        If $aCursorInfo[2] Then
            If $aCursorInfo[4] = $hPCNumInput Then GUICtrlSetData($hPCNumInput, "")
        EndIf
    WEnd
EndFunc



;Profit Center Tools ----------

;Ping PC Gateway
Func PingPCGateway()
    $iIPO1 = 10
    $iIPO4 = 1
    IPAddress()
    If $iIPO2 = 0 Then
        Return
    EndIf
    PingCmd()
EndFunc   ;==>PingPCGateway

;FortiWiFi Web Login
Func FortiWiFiWebLogin()
    $iIPO1 = 10
    $iIPO4 = 1
    IPAddress()
    If $iIPO2 = 0 Then
        Return
    EndIf
    ShellExecute("https://" & $iIPAddress)
EndFunc   ;==>FortiWiFiWebLogin

;FortiWiFi Putty Login
Func FortiWiFiPuttyLogin()
    $iIPO1 = 10
    $iIPO4 = 1
    IPAddress()
    If $iIPO2 = 0 Then
        Return
    EndIf
    IPAddress()
    PuttyLogin()
EndFunc   ;==>FortiWiFiPuttyLogin

;Extrapolate Second and Third Octet From PC Number
Func GetPCNumber()
    Local $iPCNumber = GUICtrlRead($hPCNumInput)
    If $iPCNumber > "" Then
        If $iPCNumber >= 1000 Then
            Local $iPCMid = StringMid($iPCNumber, 2, 2)
            If $iPCMid = 0 Then
                $iIPO2 = StringLeft($iPCNumber, 2)
                $iIPO3 = StringRight($iPCNumber, 1)
            Else
                $iIPO2 = StringLeft($iPCNumber, 2)
                $iIPO3 = StringRight($iPCNumber, 2)
            EndIf
            If $iIPO3 = 0 Then
                $iIPO3 = 100
            EndIf
        ElseIf $iPCNumber < 1000 Then
            Local $iPCFirstTwoDigits = StringTrimRight($iPCNumber, 2)
            $iIPO2 = StringTrimLeft($iPCFirstTwoDigits, 1)
            If $iIPO2 = 0 Then
                MsgBox(262160, "Invalid Entry", "Please Enter a Valid Four Digit PC Number")
                GUICtrlSetData($hPCNumInput, "")
                _WinAPI_SetFocus(ControlGetHandle("CED Help Desk Utility", "", $hPCNumInput))
            EndIf
            Local $iPCLastTwoDigits = StringTrimLeft($iPCNumber, 2)
            If StringLeft($iPCLastTwoDigits, 1) = 0 Then
                $iIPO3 = StringRight($iPCLastTwoDigits, 1)
            Else
                $iIPO3 = $iPCLastTwoDigits
            EndIf
        EndIf
    ElseIf $iPCNumber = "" Then
        MsgBox(262160, "Invalid Entry", "Please Enter a Valid Four Digit PC Number")
        _WinAPI_SetFocus(ControlGetHandle("CED Help Desk Utility", "", $hPCNumInput))
    EndIf
EndFunc   ;==>GetPCNumber

;Combine IP Address Octets
Func IPAddress()
    $iIPAddress = ($iIPO1 & "." & $iIPO2 & "." & $iIPO3 & "." & $iIPO4)
EndFunc   ;==>IPAddress

;Ping Command
Func PingCmd()
    Run(@ComSpec & " /k" & "ping.exe -t " & $iIPAddress)
EndFunc   ;==>PingCmd

;Putty Login
Func PuttyLogin()
    Run("putty.exe " & $iIPAddress)
EndFunc   ;==>PuttyLogin

;Create Putty Directory and Copy Putty.exe
Func CreatePuttyDir_CopyPutty()
    Local $PuttyFile = "c:\Program files\PuTTY\putty.exe"
    If FileExists($PuttyFile) = 1 Then
        FileDelete(@WorkingDir & "\CreatePuttyDirectory.exe")
        Return
    ElseIf FileExists($PuttyFile) = 0 Then
        ShellExecute("CreatePuttyDirectory.exe", @WorkingDir, @SW_HIDE)
    EndIf
EndFunc   ;==>CreatePuttyDir_CopyPutty

;Embed Putty.exe When Compiled
Func EmbedCreatePuttyDirectoryFile()
    Local $PuttyFile = "c:\Program files\PuTTY\putty.exe"
    If FileExists($PuttyFile) Then
        Return
    Else
        FileInstall("C:\PuTTy\putty.exe", @WorkingDir & "\")
        FileInstall("C:\PuTTy\CreatePuttyDirectory.exe", @WorkingDir & "\")
    EndIf
EndFunc   ;==>EmbedCreatePuttyDirectoryFile

;Check Check Box Status For PC Tools
Func CheckBoxStatus()
    Local $iPCNumber = GUICtrlRead($hPCNumInput)
    If $iPCNumber = "" Then
        Return
    Else
        Local $CheckboxPingPCStatus = ControlCommand($hCEDForm, "", $hCheckboxPingPC, "IsChecked")
        Local $CheckboxFortiWiFiWebStatus = ControlCommand($hCEDForm, "", $hCheckboxFortiWiFiWeb, "IsChecked")
        Local $CheckboxFortiWiFiPuttyStatus = ControlCommand($hCEDForm, "", $hCheckboxFortiWiFiPutty, "IsChecked")
        If $CheckboxPingPCStatus = 1 Then
            PingPCGateway()
        EndIf
        If $CheckboxFortiWiFiWebStatus = 1 Then
            FortiWiFiWebLogin()
        EndIf
        If $CheckboxFortiWiFiPuttyStatus = 1 Then
            FortiWiFiPuttyLogin()
        EndIf
    EndIf
EndFunc   ;==>CheckBoxStatus


; Network Tools ----------

; Ping IP Address
Func PingIPInput()
    Local $CheckboxClearIPStatus = ControlCommand($hCEDForm, "", $hCheckboxClearIP, "IsChecked")
    Local $PingIPAddressInput = GUICtrlRead($hIPAddressInput)
    Run(@ComSpec & " /k" & "ping.exe -t " & $PingIPAddressInput)
    If $CheckboxClearIPStatus = 1 Then
        GUICtrlSetData($hIPAddressInput, "")
    EndIf
EndFunc   ;==>PingIPInput
If you can assist me further I would appreciate it. Edited by Melba23
Fixed tags

Share this post


Link to post
Share on other sites
Melba23

m1975michael,

That sounds as if you are not returning to the main loop, so I suggest you add some error-checking to the code. If you run it from SciTE put a ConsoleWrite before and after each function call announcing where you are in the script - then you can follow it as it passes from one function to another. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
m1975michael

m1975michael,

That sounds as if you are not returning to the main loop, so I suggest you add some error-checking to the code. If you run it from SciTE put a ConsoleWrite before and after each function call announcing where you are in the script - then you can follow it as it passes from one function to another. :)

M23

Ok, I will try that thank you.  I'm fairly new to scripting. :)

Share this post


Link to post
Share on other sites
Melba23

m1975michael,

I'm fairly new to scripting

No problem - we all were at one point. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×