Jump to content
Sign in to follow this  
atnextc

Create "Main Menu" GUI for Scripts

Recommended Posts

atnextc

Now I have a new problem......I"m trying to create "main menu" for the 4 scripts that I have created and save this one file to an exe so I can give this out instead of 4 exe's to compile these scripts.

Below is what I have but it's not working as planned.

Any help is appreciated.

"MAIN MENU"

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "Multipath.au3"
#include "Multihop.au3"
#include "LACP.au3"
#include "Public.au3"

$Form1_1 = GUICreate("Cox C4 Process", 476, 229, 191, 255)
$C4lbl = GUICtrlCreateLabel("COX BGP Configs", 248, 32, 89, 17)
$Multipath = GUICtrlCreateRadio("Multipath Private", 40, 72, 193, 17)
$LACP = GUICtrlCreateRadio("LACP Private", 40, 96, 169, 17)
$Multihop = GUICtrlCreateRadio("Multihop Private", 40, 120, 241, 17)
$OK = GUICtrlCreateButton("OK", 40, 176, 75, 25)
$Public = GUICtrlCreateRadio("Public Peer", 40, 144, 241, 17)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $OK
If GUICtrlRead($Multipath) = 1 Then
Run('AutoIt3.exe Multipath.au3')
EndIf
If GUICtrlRead($LACP) = 1 Then
Run('AutoIt3.exe LACP.au3')
EndIf
If GUICtrlRead($Multihop) = 1 Then
Run('AutoIt3.exe Multihop.au3')
EndIf
If GUICtrlRead($Public) = 1 Then
Run('AutoIt3.exe Public.au3')
EndIf
EndSwitch
WEnd

"LACP"

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
$_1 = GUICreate("Cox LACP Private Peering Turn Up", 920, 614, 191, 123)
$Label1 = GUICtrlCreateLabel("Cox LACP Private BGP Turn Up", 208, 24, 370, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Router = GUICtrlCreateInput("", 136, 128, 84, 21)
$Circuit = GUICtrlCreateInput("", 136, 158, 84, 21)
$Peer = GUICtrlCreateInput("", 136, 184, 84, 21)
$AE = GUICtrlCreateInput("", 136, 216, 84, 21)
$PeerA = GUICtrlCreateInput("", 136, 242, 84, 21)
$Interface = GUICtrlCreateInput("", 136, 270, 84, 21)
$IPv4 = GUICtrlCreateInput("", 136, 320, 84, 21)
$IPv4SubnetMask = GUICtrlCreateInput("", 136, 352, 84, 21)
$IPv6 = GUICtrlCreateInput("", 136, 384, 84, 21)
$IPv6SubnetMask = GUICtrlCreateInput("", 136, 416, 84, 21)
$md5 = GUICtrlCreateInput("", 136, 448, 84, 21)
$locip = GUICtrlCreateInput("", 136, 480, 81, 21)
$LocalIP6 = GUICtrlCreateInput("", 136, 512, 81, 21)
$Submit = GUICtrlCreateButton("Submit", 136, 544, 97, 33)
$Save = GUICtrlCreateButton("Save", 664, 536, 97, 33)
$CopyClipboard = GUICtrlCreateButton("Copy To Clipboard", 776, 536, 113, 33)
$MOP = GUICtrlCreateEdit("", 248, 128, 641, 353)
GUICtrlSetData(-1, "")
$RouterName = GUICtrlCreateLabel("Input Router Name", 40, 132, 94, 17)
$Label3 = GUICtrlCreateLabel("Input Interface", 40, 273, 73, 17)
$Label4 = GUICtrlCreateLabel("Input Peer Name", 40, 186, 84, 17)
$V4IP = GUICtrlCreateLabel("Peer v4 IP", 40, 324, 56, 17)
$Label5 = GUICtrlCreateLabel("Input v4 Mask", 40, 354, 72, 17)
$v6IP = GUICtrlCreateLabel("Peer v6 IP", 40, 386, 56, 17)
$v6Mask = GUICtrlCreateLabel("Input v6 Mask", 40, 418, 72, 17)
$PeerAS = GUICtrlCreateLabel("Input Peer AS", 40, 246, 70, 17)
$Label6 = GUICtrlCreateLabel("Input Circuit ID", 40, 162, 74, 17)
$MD5key = GUICtrlCreateLabel("Input MD5 Key", 40, 450, 75, 17)
$LocalIP = GUICtrlCreateLabel("Input Local IP", 40, 482, 70, 17)
$Label2 = GUICtrlCreateLabel("Local v6 IP", 40, 514, 58, 17)
$Clear = GUICtrlCreateButton("Clear", 24, 544, 99, 33)
$Label7 = GUICtrlCreateLabel("Input AE", 40, 218, 45, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Does the AE already exist?", 40, 300, 145, 17)
GUISetState(@SW_SHOW)
GUICtrlSetState(-1, $GUI_SHOW)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
     Case $GUI_EVENT_CLOSE
         ExitLoop
Case $Checkbox1
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
         GUICtrlSetState($locip, $GUI_HIDE) ; Hide the buttons again <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetState($LocalIP6, $GUI_HIDE)
GUICtrlSetState($IPv4SubnetMask, $GUI_HIDE)
GUICtrlSetState($IPv6SubnetMask, $GUI_HIDE)
GUICtrlSetState($md5, $GUI_HIDE)
GUICtrlSetState($V4IP, $GUI_HIDE)
GUICtrlSetState($Label5, $GUI_HIDE)
GUICtrlSetState($v6IP, $GUI_HIDE)
GUICtrlSetState($v6Mask, $GUI_HIDE)
GUICtrlSetState($LocalIP, $GUI_HIDE)
GUICtrlSetState($Label2, $GUI_HIDE)
GUICtrlSetState($MD5key, $GUI_HIDE)
GUICtrlSetState($ipv4, $GUI_HIDE)
GUICtrlSetState($IPv6, $GUI_HIDE)
Else
GUICtrlSetState($locip, $GUI_SHOW) ; SHOW the buttons again <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetState($LocalIP6, $GUI_SHOW)
GUICtrlSetState($IPv4, $GUI_SHOW)
GUICtrlSetState($IPv4SubnetMask, $GUI_SHOW)
GUICtrlSetState($IPv6SubnetMask, $GUI_SHOW)
GUICtrlSetState($IPv6, $GUI_SHOW)
GUICtrlSetState($md5, $GUI_SHOW)
GUICtrlSetState($V4IP, $GUI_SHOW)
GUICtrlSetState($Label5, $GUI_SHOW)
GUICtrlSetState($v6IP, $GUI_SHOW)
GUICtrlSetState($V4IP, $GUI_SHOW)
GUICtrlSetState($v6Mask, $GUI_SHOW)
GUICtrlSetState($LocalIP, $GUI_SHOW)
GUICtrlSetState($Label2, $GUI_SHOW)
GUICtrlSetState($MD5key, $GUI_SHOW)
GUICtrlSetData($MOP,"")
EndIf
     Case $Clear
         GUICtrlSetData($md5, "") ; Use native functions on native controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetData($Interface, "")
         GUICtrlSetData($IPv4, "")
         GUICtrlSetData($IPv4SubnetMask, "")
         GUICtrlSetData($IPv6, "")
         GUICtrlSetData($IPv6SubnetMask, "")
         GUICtrlSetData($Router, "")
         GUICtrlSetData($Peer, "")
         GUICtrlSetData($PeerA, "")
         GUICtrlSetData($LocIP, "")
         GUICtrlSetData($LocalIP6, "")
         GUICtrlSetData($Circuit, "")
GUICtrlSetData($AE, "")
GUICtrlSetData($MOP,"")
Case $Submit
_Action4()
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
_AE_Exists()
Else
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
_AE_Exists()
     ClipPut(GUICtrlRead($MOP))
     ;GUICtrlSetState($CopyClipboard, $GUI_SHOW) ; Show the buttons <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
     ;GUICtrlSetState($Save, $GUI_SHOW)
EndIf
EndIf
Case $CopyClipboard
ClipPut(GUICtrlRead($MOP))
EndSwitch
WEnd
Func _Action4()
$CircuitRead = GUICtrlRead($Circuit);Reads the value of the Circuit ID input Box
$InterfaceRead = GUICtrlRead($Interface);Reads the value of the Interface ID input Box
$PeerRead = GUICtrlRead($Peer);Reads the value of the Peer Name ID input Box
$ASRead = GUICtrlRead($PeerA);Reads the value of the Peer Name ID input Box
$RouterRead = GUICtrlRead($Router)
$IPv4Read = GUICtrlRead($IPv4);Reads the value of the IP v 4 ID input Box
$IPv4SubnetMaskRead = GUICtrlRead($IPv4SubnetMask);Reads the value of the IP v4 Subnet ID input Box
$IPv6Read = GUICtrlRead($IPv6);Reads the value of the IP v 6 ID input Box
$IPv6SubnetMaskRead = GUICtrlRead($IPv6SubnetMask);Reads the value of the IP v6 Subnet ID input Box
$LocalIPRead = GUICtrlRead($LocIP);Reads the value of the IP v6 Subnet ID input Box
$MD5Read = GUICtrlRead($md5);Reads the value of the IP v6 Subnet ID input Box
$LocalIP6Read = GUICtrlRead($LocalIP6);Reads the value of the IP v6 Subnet ID input Box
$AERead= GUICtrlRead($AE);Reads the value of the IP v6 Subnet ID input Box
; Here we just reset the content of the edit - not recreate it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetData($MOP, $RouterRead & @CRLF & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " description "";" & $CircuitRead & ";Peer " & $PeerRead & ' (AS ' & $ASRead & _
                     ");;MR;10GE To " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " gigether-options 802.3ad ae" & $AERead & @CRLF & @CRLF & @CRLF & "set interfaces ae" & $AERead & _
                     " mtu 4484" & @CRLF & "set interfaces ae" & $AERead & _
                     " aggregated-ether-options no-flow-control" & @CRLF & "set interfaces ae" & $AERead & _
                     " aggregated-ether-options minimum-links 1 " & @CRLF & "set interfaces ae" & $AERead & _
                     " aggregated-ether-options link-speed 10g " & @CRLF & "set interfaces ae" & $AERead & _
     " aggregated-ether-options lacp active" & @CRLF & "set interfaces ae" & $AERead & _
     " unit 0 description "";" & $CircuitRead & ";Peer " & $PeerRead & ' (AS ' & $ASRead & _
                     ");;MR;10GE To " & $PeerRead & ' (AS ' & $ASRead & ")" & _
     @CRLF &"set interfaces ae" & $AERead & _
                     " unit 0 family inet mtu 1500" & @CRLF & "set interfaces ae" & $AERead & _
                     " unit 0 family inet filter input EDGE-IN" & @CRLF & "set interfaces ae" & $AERead & _
                     " unit 0 family inet filter output EDGE-OUT" & @CRLF & "set interfaces ae" & $AERead & _
                     " unit 0 family inet address " & $LocalIPRead & "/" & $IPv4SubnetMaskRead & _
                     @CRLF & "set interfaces ae" & $AERead & " unit 0 family inet6 filter input EDGE-INV6" & @CRLF & "set interfaces ae" & $AERead & _
                     " unit 0 family inet6 filter output EDGE-OUTV6" & @CRLF & "set interfaces ae" & $AERead & _
                     " unit 0 family inet6 address " & $LocalIP6Read & "/" & $IPv6SubnetMaskRead & @CRLF & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "local-address " & $LocalIPRead & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "authentication-key " & $MD5Read & _
                     @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "peer-as " & $ASRead & @CRLF & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "local-address " & $LocalIP6Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "authentication-key " & $MD5Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "peer-as " & $ASRead & @CRLF & @CRLF & "show | compare" & @CRLF & "commit check" & @CRLF & "commit sync and quit" & @CRLF & _
                     "show log messages | last"& @CRLF & @CRLF & "==========================================" & @CRLF & @CRLF &"VERIFICATION COMMANDS" & @CRLF & @CRLF & "ping " & $IPv4Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv4Read & @CRLF & @CRLF & _
                     "ping " & $IPv6Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv6Read)
EndFunc
Func _AE_Exists()
$CircuitRead = GUICtrlRead($Circuit);Reads the value of the Circuit ID input Box
$InterfaceRead = GUICtrlRead($Interface);Reads the value of the Interface ID input Box
$PeerRead = GUICtrlRead($Peer);Reads the value of the Peer Name ID input Box
$ASRead = GUICtrlRead($PeerA);Reads the value of the Peer Name ID input Box
$RouterRead = GUICtrlRead($Router)
$IPv4Read = GUICtrlRead($IPv4);Reads the value of the IP v 4 ID input Box
$IPv4SubnetMaskRead = GUICtrlRead($IPv4SubnetMask);Reads the value of the IP v4 Subnet ID input Box
$IPv6Read = GUICtrlRead($IPv6);Reads the value of the IP v 6 ID input Box
$IPv6SubnetMaskRead = GUICtrlRead($IPv6SubnetMask);Reads the value of the IP v6 Subnet ID input Box
$LocalIPRead = GUICtrlRead($LocIP);Reads the value of the IP v6 Subnet ID input Box
$MD5Read = GUICtrlRead($md5);Reads the value of the IP v6 Subnet ID input Box
$LocalIP6Read = GUICtrlRead($LocalIP6);Reads the value of the IP v6 Subnet ID input Box
$AERead= GUICtrlRead($AE);Reads the value of the IP v6 Subnet ID input Box

;LACP AE INTERFACE ALREADY EXISTS AND BGP IS NOT SETUP YET!!
GUICtrlSetData($MOP,$RouterRead & @CRLF & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " description "";" & $CircuitRead & ";Peer " & $PeerRead & ' (AS ' & $ASRead & _
                     ");;MR;10GE To " & $AERead & ' (AS ' & $ASRead & ")""" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " gigether-options ae" & $AERead & @CRLF & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "local-address " & $LocalIPRead & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "authentication-key " & $MD5Read & _
                     @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "peer-as " & $ASRead & @CRLF & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "local-address " & $LocalIP6Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "authentication-key " & $MD5Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "peer-as " & $ASRead & @CRLF & @CRLF &"show | compare" & @CRLF & "commit check" & @CRLF & "commit sync and quit" & @CRLF & _
                     "show log messages | last" & @CRLF & @CRLF & "==========================================" & @CRLF & @CRLF &"VERIFICATION COMMANDS" & @CRLF & @CRLF & "ping " & $IPv4Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv4Read & @CRLF & @CRLF & _
                     "ping " & $IPv6Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv6Read)
     EndFunc

"Multipath"

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
$_1 = GUICreate("Cox Multipath Private BGP Turn Up", 920, 614, 191, 123)
$Label1 = GUICtrlCreateLabel("Cox Multipath Private BGP Turn Up", 208, 24, 397, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Router = GUICtrlCreateInput("", 136, 128, 84, 21)
$Circuit = GUICtrlCreateInput("", 136, 158, 84, 21)
$Peer = GUICtrlCreateInput("", 136, 184, 84, 21)
$PeerA = GUICtrlCreateInput("", 136, 216, 84, 21)
$Interface = GUICtrlCreateInput("", 136, 246, 84, 21)
$IPv4 = GUICtrlCreateInput("", 136, 272, 84, 21)
$IPv4SubnetMask = GUICtrlCreateInput("", 136, 304, 84, 21)
$IPv6 = GUICtrlCreateInput("", 136, 336, 84, 21)
$IPv6SubnetMask = GUICtrlCreateInput("", 136, 368, 84, 21)
$md5 = GUICtrlCreateInput("", 136, 400, 84, 21)
$LocIP = GUICtrlCreateInput("", 136, 432, 81, 21)
$LocalIP6 = GUICtrlCreateInput("", 136, 464, 81, 21)
$Submit = GUICtrlCreateButton("Submit", 136, 504, 97, 33)
$RouterName = GUICtrlCreateLabel("Router Name", 40, 132, 94, 17)
$Label3 = GUICtrlCreateLabel("Interface", 40, 249, 73, 17)
$Label4 = GUICtrlCreateLabel("Peer Name", 40, 186, 84, 17)
$V4IP = GUICtrlCreateLabel("Peer v4 IP", 40, 276, 56, 17)
$Label5 = GUICtrlCreateLabel("Peer v4 Mask", 40, 306, 72, 17)
$v6IP = GUICtrlCreateLabel("Peer v6 IP", 40, 338, 56, 17)
$v6Mask = GUICtrlCreateLabel("Peer v6 Mask", 40, 370, 72, 17)
$PeerAS = GUICtrlCreateLabel("Peer AS", 40, 218, 70, 17)
$Label6 = GUICtrlCreateLabel("Circuit ID", 40, 162, 74, 17)
$MD5key = GUICtrlCreateLabel("MD5 Key", 40, 402, 75, 17)
$LocalIP = GUICtrlCreateLabel("Local v4 IP", 40, 434, 70, 17)
$LocaIP6 = GUICtrlCreateLabel("Local v6 IP", 40, 466, 58, 17)
$Clear = GUICtrlCreateButton("Clear", 24, 504, 99, 33)
; Create Edit and Buttons here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$MOP = GUICtrlCreateEdit("", 248, 128, 641, 353)
$CopyClipboard = GUICtrlCreateButton("Copy To Clipboard", 776, 504, 113, 33)
GUICtrlSetState(-1, $GUI_SHOW) ; Hide buttons <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$Save = GUICtrlCreateButton("Save", 664, 504, 97, 33)
GUICtrlSetState(-1, $GUI_SHOW)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
     Case $GUI_EVENT_CLOSE
         ExitLoop
     Case $Clear
GUICtrlSetData($md5, "") ; Use native functions on native controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetData($Interface, "")
         GUICtrlSetData($IPv4, "")
         GUICtrlSetData($IPv4SubnetMask, "")
         GUICtrlSetData($IPv6, "")
         GUICtrlSetData($IPv6SubnetMask, "")
         GUICtrlSetData($Router, "")
         GUICtrlSetData($Peer, "")
         GUICtrlSetData($PeerA, "")
         GUICtrlSetData($LocIP, "")
         GUICtrlSetData($LocalIP6, "")
         GUICtrlSetData($Circuit, "")
GUICtrlSetData($MOP,"")
     Case $Submit
         _Action()
         GUICtrlSetState($CopyClipboard, $GUI_SHOW) ; Show the buttons <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetState($Save, $GUI_SHOW)
Case $CopyClipboard
ClipPut(GUICtrlRead($MOP))
EndSwitch
WEnd
Func _Action()
$CircuitRead = GUICtrlRead($Circuit);Reads the value of the Circuit ID input Box
$InterfaceRead = GUICtrlRead($Interface);Reads the value of the Interface ID input Box
$PeerRead = GUICtrlRead($Peer);Reads the value of the Peer Name ID input Box
$ASRead = GUICtrlRead($PeerA);Reads the value of the Peer Name ID input Box
$RouterRead = GUICtrlRead($Router)
$IPv4Read = GUICtrlRead($IPv4);Reads the value of the IP v 4 ID input Box
$IPv4SubnetMaskRead = GUICtrlRead($IPv4SubnetMask);Reads the value of the IP v4 Subnet ID input Box
$IPv6Read = GUICtrlRead($IPv6);Reads the value of the IP v 6 ID input Box
$IPv6SubnetMaskRead = GUICtrlRead($IPv6SubnetMask);Reads the value of the IP v6 Subnet ID input Box
$LocalIPRead = GUICtrlRead($LocIP);Reads the value of the IP v6 Subnet ID input Box
$MD5Read = GUICtrlRead($md5);Reads the value of the IP v6 Subnet ID input Box
$LocalIP6Read = GUICtrlRead($LocalIP6);Reads the value of the IP v6 Subnet ID input Box
; Here we just reset the content of the edit - not recreate it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetData($MOP, $RouterRead & @CRLF & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 description "";" & $CircuitRead & ";Peer " & $PeerRead & ' (AS ' & $ASRead & _
                     ");;MR;10GE To " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet mtu 1500" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet filter input EDGE-IN" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet filter output EDGE-OUT" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet address " & $LocalIPRead & "/" & $IPv4SubnetMaskRead & _
                     @CRLF & "set interfaces xe-" & $InterfaceRead & " unit 0 family inet6 filter input EDGE-INV6" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet6 filter output EDGE-OUTV6" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet6 address " & $LocalIP6Read & "/" & $IPv6SubnetMaskRead & @CRLF & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "local-address " & $LocalIPRead & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "authentication-key " & $MD5Read & _
                     @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "peer-as " & $ASRead & @CRLF & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "local-address " & $LocalIP6Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "authentication-key " & $MD5Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "peer-as " & $ASRead & @CRLF & @CRLF & "show | compare" & @CRLF & "commit check" & @CRLF & "commit sync and quit" & @CRLF & _
                     "show log messages | last"& @CRLF & @CRLF & "==========================================" & @CRLF & @CRLF &"VERIFICATION COMMANDS" & @CRLF & @CRLF & "ping " & $IPv4Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv4Read & @CRLF & @CRLF & _
                     "ping " & $IPv6Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv6Read)
EndFunc

"Multihop"

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$_1 = GUICreate("Cox Multihop BGP Turn Up", 920, 614, 191, 123)
$Label1 = GUICtrlCreateLabel("Cox Multihop BGP Turn Up", 208, 24, 397, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Router = GUICtrlCreateInput("", 136, 128, 84, 21)
$Circuit = GUICtrlCreateInput("", 136, 158, 84, 21)
$Peer = GUICtrlCreateInput("", 136, 184, 84, 21)
$PeerA = GUICtrlCreateInput("", 136, 216, 84, 21)
$Interface = GUICtrlCreateInput("", 136, 246, 84, 21)
$IPv4 = GUICtrlCreateInput("", 136, 272, 84, 21)
$IPv4SubnetMask = GUICtrlCreateInput("", 136, 304, 84, 21)
$IPv6 = GUICtrlCreateInput("", 136, 336, 84, 21)
$IPv6SubnetMask = GUICtrlCreateInput("", 136, 368, 84, 21)
$md5 = GUICtrlCreateInput("", 136, 400, 84, 21)
$LocIP = GUICtrlCreateInput("", 136, 432, 81, 21)
$LocalIP6 = GUICtrlCreateInput("", 136, 464, 81, 21)
$RouterName = GUICtrlCreateLabel("Router Name", 40, 132, 94, 17)
$Label3 = GUICtrlCreateLabel("Interface", 40, 249, 73, 17)
$Label4 = GUICtrlCreateLabel("Peer Name", 40, 186, 84, 17)
$V4IP = GUICtrlCreateLabel("Peer v4 IP", 40, 276, 56, 17)
$Label5 = GUICtrlCreateLabel("Peer v4 Mask", 40, 306, 72, 17)
$v6IP = GUICtrlCreateLabel("Peer v6 IP", 40, 338, 56, 17)
$v6Mask = GUICtrlCreateLabel("Peer v6 Mask", 40, 370, 72, 17)
$PeerAS = GUICtrlCreateLabel("Peer AS", 40, 218, 70, 17)
$Label6 = GUICtrlCreateLabel("Circuit ID", 40, 162, 74, 17)
$MD5key = GUICtrlCreateLabel("MD5 Key", 40, 402, 75, 17)
$LocalIP = GUICtrlCreateLabel("Local v4 IP", 40, 434, 70, 17)
$LocaIP6 = GUICtrlCreateLabel("Local v6 IP", 40, 466, 58, 17)
$Label7 = GUICtrlCreateLabel("Next Hop v4 IP", 40, 498, 77, 17)
$Label8 = GUICtrlCreateLabel("Next Hop v6 IP", 40, 530, 77, 17)
$NH = GUICtrlCreateInput("", 136, 496, 81, 21)
$NH6 = GUICtrlCreateInput("", 136, 528, 81, 21)
$Clear = GUICtrlCreateButton("Clear", 24, 568, 99, 33)
$Submit = GUICtrlCreateButton("Submit", 136, 568, 97, 33)
$Save = GUICtrlCreateButton("Save", 664, 560, 97, 33)
$CopyClipboard = GUICtrlCreateButton("Copy To Clipboard", 776, 560, 113, 33)
$MOP = GUICtrlCreateEdit("", 248, 128, 641, 353)
GUICtrlSetState(-1, $GUI_SHOW)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
     Case $GUI_EVENT_CLOSE
         ExitLoop
     Case $Clear
GUICtrlSetData($md5, "") ; Use native functions on native controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetData($Interface, "")
         GUICtrlSetData($IPv4, "")
         GUICtrlSetData($IPv4SubnetMask, "")
         GUICtrlSetData($IPv6, "")
         GUICtrlSetData($IPv6SubnetMask, "")
         GUICtrlSetData($Router, "")
         GUICtrlSetData($Peer, "")
         GUICtrlSetData($PeerA, "")
         GUICtrlSetData($LocIP, "")
         GUICtrlSetData($LocalIP6, "")
         GUICtrlSetData($Circuit, "")
GUICtrlSetData($MOP,"")
     Case $Submit
         _Action3()
         GUICtrlSetState($CopyClipboard, $GUI_SHOW) ; Show the buttons <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetState($Save, $GUI_SHOW)
Case $CopyClipboard
ClipPut(GUICtrlRead($MOP))
EndSwitch
WEnd
Func _Action3()
$CircuitRead = GUICtrlRead($Circuit);Reads the value of the Circuit ID input Box
$InterfaceRead = GUICtrlRead($Interface);Reads the value of the Interface ID input Box
$PeerRead = GUICtrlRead($Peer);Reads the value of the Peer Name ID input Box
$ASRead = GUICtrlRead($PeerA);Reads the value of the Peer Name ID input Box
$RouterRead = GUICtrlRead($Router)
$IPv4Read = GUICtrlRead($IPv4);Reads the value of the IP v 4 ID input Box
$IPv4SubnetMaskRead = GUICtrlRead($IPv4SubnetMask);Reads the value of the IP v4 Subnet ID input Box
$IPv6Read = GUICtrlRead($IPv6);Reads the value of the IP v 6 ID input Box
$IPv6SubnetMaskRead = GUICtrlRead($IPv6SubnetMask);Reads the value of the IP v6 Subnet ID input Box
$LocalIPRead = GUICtrlRead($LocIP);Reads the value of the IP v6 Subnet ID input Box
$MD5Read = GUICtrlRead($md5);Reads the value of the IP v6 Subnet ID input Box
$LocalIP6Read = GUICtrlRead($LocalIP6);Reads the value of the IP v6 Subnet ID input Box
$NHRead = GUICtrlRead($NH)
$NH6Read = GUICtrlRead($NH6)
; Here we just reset the content of the edit - not recreate it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetData($MOP, $RouterRead & @CRLF & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 description "";" & $CircuitRead & ";Peer " & $PeerRead & ' (AS ' & $ASRead & _
                     ");;MR;10GE To " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet mtu 1500" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet filter input EDGE-IN" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet filter output EDGE-OUT" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet address " & $LocalIPRead & "/" & $IPv4SubnetMaskRead & _
                     @CRLF & "set interfaces xe-" & $InterfaceRead & " unit 0 family inet6 filter input EDGE-INV6" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet6 filter output EDGE-OUTV6" & @CRLF & "set interfaces xe-" & $InterfaceRead & _
                     " unit 0 family inet6 address " & $LocalIP6Read & "/" & $IPv6SubnetMaskRead & @CRLF & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
     "multihop ttl 2"& @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     "local-address " & $LocalIPRead & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "authentication-key " & $MD5Read & _
                     @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & "peer-as " & $ASRead & @CRLF & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "description ""Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & "local-address " & $LocalIP6Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "authentication-key " & $MD5Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     "peer-as " & $ASRead & @CRLF & @CRLF & "set routing-options static route " & $IPv4Read & "/32 next-hop" & $NHRead & @CRLF & "set routing-options rib inet6.0 static route " & $IPv6Read & "/32 next-hop" & $NH6Read & @CRLF & _
     @CRLF & @CRLF &"show | compare" & @CRLF & "commit check" & @CRLF & "commit sync and quit" & @CRLF & _
                     "show log messages | last"& @CRLF & @CRLF & "==========================================" & @CRLF & @CRLF &"VERIFICATION COMMANDS" & @CRLF & @CRLF & "ping " & $IPv4Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv4Read & @CRLF & @CRLF & _
                     "ping " & $IPv6Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv6Read)
EndFunc

"Public"

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

$_1 = GUICreate("Cox Public Peering Turn Up", 920, 614, -1183, 123)
$Label1 = GUICtrlCreateLabel("Cox Public Peering Turn Up", 208, 24, 397, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Router = GUICtrlCreateInput("", 136, 128, 84, 21)
$Peer = GUICtrlCreateInput("", 136, 160, 84, 21)
$PeerA = GUICtrlCreateInput("", 136, 192, 84, 21)
$IPv4 = GUICtrlCreateInput("", 136, 224, 84, 21)
$IPv6 = GUICtrlCreateInput("", 136, 256, 84, 21)
$md5 = GUICtrlCreateInput("", 136, 288, 84, 21)
$Clear = GUICtrlCreateButton("Clear", 24, 504, 99, 33)
$Submit = GUICtrlCreateButton("Submit", 136, 504, 97, 33)
$Save = GUICtrlCreateButton("Save", 664, 504, 97, 33)
$CopyClipboard = GUICtrlCreateButton("Copy To Clipboard", 776, 504, 113, 33)
$MOP = GUICtrlCreateEdit("", 248, 128, 641, 353)
GUICtrlSetData(-1, "")
$RouterName = GUICtrlCreateLabel("Input Router Name", 40, 132, 94, 17)
$Label4 = GUICtrlCreateLabel("Input Peer Name", 40, 162, 84, 17)
$V4IP = GUICtrlCreateLabel("Peer v4 IP", 40, 228, 54, 17)
$v6IP = GUICtrlCreateLabel("Peer v6 IP", 40, 258, 54, 17)
$PeerAS = GUICtrlCreateLabel("Input Peer AS", 40, 194, 70, 17)
$MD5key = GUICtrlCreateLabel("Input MD5 Key", 40, 290, 75, 17)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
     Case $GUI_EVENT_CLOSE
         ExitLoop
     Case $Clear
GUICtrlSetData($md5, "") ; Use native functions on native controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         GUICtrlSetData($IPv4, "")
         GUICtrlSetData($IPv6, "")
         GUICtrlSetData($Router, "")
         GUICtrlSetData($Peer, "")
         GUICtrlSetData($PeerA, "")
         GUICtrlSetData($MOP,"")
     Case $Submit
         _Action5()
         GUICtrlSetState($Save, $GUI_SHOW)
Case $CopyClipboard
ClipPut(GUICtrlRead($MOP))
EndSwitch
WEnd
Func _Action5()

$PeerRead = GUICtrlRead($Peer);Reads the value of the Peer Name ID input Box
$ASRead = GUICtrlRead($PeerA);Reads the value of the Peer Name ID input Box
$RouterRead = GUICtrlRead($Router)
$IPv4Read = GUICtrlRead($IPv4);Reads the value of the IP v 4 ID input Box
$IPv6Read = GUICtrlRead($IPv6);Reads the value of the IP v 6 ID input Box
$MD5Read = GUICtrlRead($md5);Reads the value of the IP v6 Subnet ID input Box
; Here we just reset the content of the edit - not recreate it <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetData($MOP, $RouterRead & @CRLF & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & _
                     " description ""Public Peering with " & $PeerRead & ' (AS ' & $ASRead & ")""" & @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & " authentication-key " & $MD5Read & _
                     @CRLF & "set protocols bgp group PEERS neighbor " & $IPv4Read & " peer-as " & $ASRead & @CRLF & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & " description ""Public Peering with " & $PeerRead & ' IPv6 (AS ' & $ASRead & ")""" & @CRLF & _
                     "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     " authentication-key " & $MD5Read & @CRLF & "set protocols bgp group PEERv6 neighbor " & $IPv6Read & _
                     " peer-as " & $ASRead & @CRLF & @CRLF & "show | compare" & @CRLF & "commit check" & @CRLF & "commit sync and quit" & @CRLF & _
                     "show log messages | last"& @CRLF & @CRLF & "==========================================" & @CRLF & @CRLF &"VERIFICATION COMMANDS" & @CRLF & @CRLF & "ping " & $IPv4Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv4Read & @CRLF & @CRLF & _
                     "ping " & $IPv6Read & " rapid count 1000" & @CRLF & "show bgp neighbor " & $IPv6Read)
EndFunc
Edited by atnextc

Share this post


Link to post
Share on other sites
guinness

To further add to what JohnOne said, perhaps creating a smaller script will show how you think it should be implemented, so we can then point out the correct approach.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
skysel

Ugh, FileInstall would be in order. First parameter is source of file on compilation, second parameter is where script extracts your file on execution. Example below (which i'm using myself)

DirCreate("C:\Program Files\NSClient++")
FileInstall("C:\NSClient\NSClient++-0.3.9-x64.msi", "C:\Program Files\NSClient++\NSClient++-0.3.9-x64.msi",1)
FileInstall("C:\NSClient\nsc.ini","C:\Program Files\NSClient++\nsc.ini",1)
RunWait('msiexec /quiet /qn /norestart /i "C:\Program Files\NSClient++\NSClient++-0.3.9-x64.msi"')
RunWait("sc start NSClientpp")
FileDelete("C:\Program Files\NSClient++\NSClient++-0.3.9-x64.msi")

Secondly, I would suggest you merge your scripts into Main Menu script. Make them functions and then on gui action call that function. Although you might have to do some global variable assigment (Dim $variable), so they're read outside the functions. That's how I'd do it - actually doing it since I've merged some scripts on my own already.

Share this post


Link to post
Share on other sites
atnextc

When I run the "main menu" script in scite it works fine and each of the other scripts opens, when the specified radio button is selected.

When i compiled it to save a a single .exe none of the scripts worked when a radio button was selected. In regards to merging them into the 'main menu' sscript I tried, but to me the issue would be this, if you actually look at the other scripts, they are all basically using the same variables with multiple functions in them already, so I am not sure how i would be able to merge all of those into 1 script.

any help is appreciated.

Share this post


Link to post
Share on other sites
skysel

When I run the "main menu" script in scite it works fine and each of the other scripts opens, when the specified radio button is selected.

When i compiled it to save a a single .exe none of the scripts worked when a radio button was selected. In regards to merging them into the 'main menu' sscript I tried, but to me the issue would be this, if you actually look at the other scripts, they are all basically using the same variables with multiple functions in them already, so I am not sure how i would be able to merge all of those into 1 script.

any help is appreciated.

Well look at my post again. FileInstall will help you with your problem. As regarding merging into 1 script, easy workaround is to change variable names.. It takes some time but at least you won't have to call multiple exe's :-)

Share this post


Link to post
Share on other sites
MHz

You can put the files in a zip as that is one file to send. Lets try FileInstall like skysel suggests. This script uses a3x files in a data folder to run. No need to merge the code and you still can send around just 1 exe.

1. Layout your source files as below

2. Compile the au3 files in the data folder to a3x

3. Compile MAIN MENU.au3 to exe

4. If done right, you will have all needed in 1 exe.

5. Copy the MAIN MENU.exe to somewhere to test

6. Run MAIN MENU and you should see a prompt to setup the data folder.

7. Once setup, then your GUI will show.

8. Further runs will reuse the a3x files already extracted to the data folder.

9. Rest after all your effort

Note: Your main script will run those a3x files.

Your source layout would be:

MAIN MENU.au3
MAIN MENU.exe
Data\LACP.a3x
Data\LACP.au3
Data\Multihop.a3x
Data\Multihop.au3
Data\Multipath.a3x
Data\Multipath.au3
Data\Public.a3x
Data\Public.au3

Extracted from MAIN MENU.exe would be:

MAIN MENU.exe
Data\LACP.a3x
Data\Multihop.a3x
Data\Multipath.a3x
Data\Public.a3x

MAIN MENU.au3

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$DataDir = @ScriptDir & '\Data'

_SetupDataDir()

$Form1_1 = GUICreate("Cox C4 Process", 476, 229, 191, 255)
$C4lbl = GUICtrlCreateLabel("COX BGP Configs", 248, 32, 89, 17)
$Multipath = GUICtrlCreateRadio("Multipath Private", 40, 72, 193, 17)
$LACP = GUICtrlCreateRadio("LACP Private", 40, 96, 169, 17)
$Multihop = GUICtrlCreateRadio("Multihop Private", 40, 120, 241, 17)
$OK = GUICtrlCreateButton("OK", 40, 176, 75, 25)
$Public = GUICtrlCreateRadio("Public Peer", 40, 144, 241, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $OK
            If GUICtrlRead($Multipath) = 1 Then
                Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript ' & $DataDir & '\Multipath.a3x')
            EndIf
            If GUICtrlRead($LACP) = 1 Then
                Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript ' & $DataDir & '\LACP.a3x')
            EndIf
            If GUICtrlRead($Multihop) = 1 Then
                Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript ' & $DataDir & '\Multihop.a3x')
            EndIf
            If GUICtrlRead($Public) = 1 Then
                Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $DataDir & '\Public.a3x"')
            EndIf
    EndSwitch
WEnd

Func _SetupDataDir()
    If Not FileExists($DataDir) Then
        ; prepare first run setup
        MsgBox(0x40000, 'First Run', 'Need to setup data folder')
        ; create the Data folder
        If Not DirCreate($DataDir) Then
            MsgBox(0x40030, 'Error', 'Failed to create ' & $DataDir)
            Exit 1
        EndIf
        ; fileinstall the a3x files
        FileInstall('Data\LACP.a3x', $DataDir & '\')
        FileInstall('Data\Multihop.a3x', $DataDir & '\')
        FileInstall('Data\Multipath.a3x', $DataDir & '\')
        FileInstall('Data\Public.a3x', $DataDir & '\')
    EndIf
EndFunc

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  

×