Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

GUI CTRL Create Edit Erasing Information When Scrolling

$
0
0
Hello all,

I have a script that I created to help with our router configs at work.  The script is working as expected, but there are a few small issues.

Pressing "Clear" after you have input information in the input boxes "works" but some  times its messing with the format of the "edit box" on the right.  Also some times its not clearing all the data on the right.

Also, I can't figure out how to get "save" working.

script included.  Any help would be appreciated.  

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
$_1 = GUICreate("Cox Public Peering 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)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   ExitLoop
  Case $Clear
   _GUICtrlEdit_SetText($md5, "")
   _GUICtrlEdit_SetText($Interface, "")
   _GUICtrlEdit_SetText($IPv4, "")
   _GUICtrlEdit_SetText($IPv4SubnetMask, "")
   _GUICtrlEdit_SetText($IPv6, "")
   _GUICtrlEdit_SetText($IPv6SubnetMask, "")
   _GUICtrlEdit_SetText($Router, "")
   _GUICtrlEdit_SetText($Peer, "")
   _GUICtrlEdit_SetText($PeerA, "")
   _GUICtrlEdit_SetText($LocIP, "")
   _GUICtrlEdit_SetText($LocalIP6, "")
   _GUICtrlEdit_SetText($Circuit, "")
   $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
   $MOP = GUICtrlCreateEdit($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 & "ping " & $IPv4Read & " rapid count 1000"& @CRLF & "show bgp neighbor "&  $IPv4Read & @CRLF & @CRLF & "ping " & $IPv6Read & " rapid count 1000"& @CRLF & "show bgp neighbor " & $IPv6Read ,248, 128, 641, 353)

  Case $Submit
   $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
   $CopyClipboard = GUICtrlCreateButton("Copy To Clipboard", 776, 504, 113, 33)
   $Save = GUICtrlCreateButton("Save", 664, 504, 97, 33)
$MOP = GUICtrlCreateEdit($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 & "ping " & $IPv4Read & " rapid count 1000"& @CRLF & "show bgp neighbor "&  $IPv4Read & @CRLF & @CRLF & "ping " & $IPv6Read & " rapid count 1000"& @CRLF & "show bgp neighbor " & $IPv6Read ,248, 128, 641, 353)
   ClipPut(GUICtrlRead ($MOP))
EndSwitch
WEnd



Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>