Jump to content

ZenKensei

Active Members
  • Posts

    72
  • Joined

  • Last visited

ZenKensei's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Group, First, in case they read this, just wanted to thank SmOke N and gafrost for helping on different pieces of this gui from previous posts, you make it look easy! Now on to the question/issue. In the following script, I have a child gui being called. The child gui prompts for certain informaiton and returns this information to the parent gui, for the most part this works as expected and without issue. However, once the child gui has ran 1 time, I cannot run it again without exiting the parent gui and restarting the script (this is probably a simple fix, but simple can be a relative term...) However I seem to be missing the logic on keeping the child gui available repeatedly, to run it over and over from the parent gui during the same instance. Second, in the child gui you'll notice a 'clear' button. I would like to have this button clear the selected fields of the combo list boxes but leave the possible selections available, i.e. allow the user to start over. Right now the only thing I seem to be able to do is clear the entire combo box, removing all possible selections from view... Let me know if anyone has any suggestions or can point out what I'm doing wrong. and as always, thanks in advance Zenkensei #include <GUIConstants.au3> Dim $ADivCombo1 Dim $ASiteCombo1 Dim $APadCombo1 Dim $AClassCombo1 Dim $AModelCombo1 Dim $AClosetCombo1 Dim $ASeriesCombo1 Dim $DivID Dim $SiteID Dim $PadID Dim $ClassID Dim $ModelID Dim $ClosetID Dim $SeriesID ; == GUI generated with Koda == $Form1 = GUICreate("AForm1", 282, 441, 192, 113) $Button1 = GUICtrlCreateButton("Switch Name", 24, 24, 73, 25) GUICtrlSetTip(-1, "Start Child Menu") $Input1 = GUICtrlCreateInput("AInput1", 112, 24, 145, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "Returned from ChildGUI") $Button2 = GUICtrlCreateButton("Ok", 24, 80, 73, 25) $Button3 = GUICtrlCreateButton("Exit", 184, 80, 73, 25) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 GUICtrlSetData($Input1, _GuiChild()) Case Else ;;;;;;; EndSelect WEnd Exit Func _GuiChild() ; == GUI generated with Koda == $CiscoNamer = GUICreate("Cisco Switch Namer", 232, 441, 367, 114) GUICtrlCreateLabel("Division:", 24, 16, 55, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select the Division") $ADivCombo1 = GUICtrlCreateCombo("", 88, 16, 121, 21) GUICtrlSetData(-1, "Bloomingdales|Bloomingdales.com|FACS Central|FACS South|FACS West|Federated Corporate|Federated Systems|Fed-Logistics|Home Office|Macys.com|Macys Marketing|Macys East|Macys Home|Macys Florida|Macys Merchandising|Macys Northwest|Macys South|Macys West|Overseas Office|Space") GUICtrlSetTip(-1, "Choose Division") GUICtrlCreateLabel("Site ID:", 24, 56, 46, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select Divisional Site ID") $ASiteCombo1 = GUICtrlCreateCombo("", 88, 56, 121, 21) GUICtrlSetData($ASiteCombo1, _ComboInsertNum3(200, 3), 'Choose Number'); 1000 and 3 are optional, just used to show you you could change it ; GUICtrlSetData(-1, "000|001|002|003|004|005") GUICtrlSetTip(-1, "Choose Site ID") GUICtrlCreateLabel("Pad ID:", 24, 96, 48, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select Store PAD ID") $APadCombo1 = GUICtrlCreateCombo("", 88, 96, 121, 21) GUICtrlSetData(-1, "X|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z") GUICtrlSetTip(-1, "Choose the site Pad ID") GUICtrlCreateLabel("Class ID:", 24, 136, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Class ID is Fixed") $AClassCombo1 = GUICtrlCreateCombo("", 88, 136, 121, 21) GUICtrlSetData(-1, "N") GUICtrlSetTip(-1, "Class ID Fixed") GUICtrlCreateLabel("Model:", 24, 176, 45, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select the Model") $AModelCombo1 = GUICtrlCreateCombo("", 88, 176, 121, 21) GUICtrlSetData(-1, "1900 Switch|2900 Switch|3500 Switch|3700 Switch") GUICtrlSetTip(-1, "Select Switch Model") GUICtrlCreateLabel("Closet:", 24, 216, 45, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select the Switch Closet") $AClosetCombo1 = GUICtrlCreateCombo("", 88, 216, 121, 21) GUICtrlSetData(-1, "Computer Room|Generic Switch|POS Room|RF|01A|01B|01C|01D|01E|01F|02A|02B|02C|02D|02E|02F|03A|03B|03C|03D|03E|03F|04A|04B|04C|04D|04E| 04F|05A|05B|05C|05D|05E|05F|06A|06B|06C|06D|06E|06F|07A|07B|07C|07D|07E|07F|08A|08B|08C|08D|08E|08F| 09A|09B|09C|09D|09E|09F|10A|10B|10C|10D|10E|10F") GUICtrlSetTip(-1, "Select Switch Closet") GUICtrlCreateLabel("Series:", 24, 256, 46, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select Switch Number") $ASeriesCombo1 = GUICtrlCreateCombo("", 88, 256, 121, 21) GUICtrlSetData($ASeriesCombo1, _ComboInsertNum2(99, 2), 'Choose Number'); 1000 and 3 are optional, just used to show you you could change it ; GUICtrlSetData(-1, "01|02|03|04|05") GUICtrlSetTip(-1, "Select Series Switch") $Button1 = GUICtrlCreateButton("Finish", 24, 400, 65, 25) GUICtrlSetTip(-1, "Accept Switch Name") $AClearButton2 = GUICtrlCreateButton("Clear", 128, 400, 65, 25) GUICtrlSetTip(-1, "Clear the Form") ; GUICtrlCreateLabel("Switch Name", 56, 312, 97, 24) ; GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ; GUICtrlSetTip(-1, "Switch Name") $ASwitchInput1 = GUICtrlCreateInput("", 24, 344, 169, 24, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Switch Name") GUISetState(@SW_SHOW) While 1 $DivID = (GUICtrlRead($ADivCombo1)) If $DivID = "Bloomingdales" Then $DivID = "BL" If $DivID = "Bloomingdales.com" Then $DivID = "BD" If $DivID = "FACS Central" Then $DivID = "FC" If $DivID = "FACS South" Then $DivID = "FA" If $DivID = "FACS West" Then $DivID = "FW" If $DivID = "Federated Corporate" Then $DivID = "FD" If $DivID = "Federated Systems" Then $DivID = "FS" If $DivID = "Fed-Logistics" Then $DivID = "FL" If $DivID = "Home Office" Then $DivID = "HO" If $DivID = "Macys.com" Then $DivID = "MD" If $DivID = "Macys Marketing" Then $DivID = "MK" If $DivID = "Macys South" Then $DivID = "MS" If $DivID = "Macys East" Then $DivID = "ME" If $DivID = "Macys Florida" Then $DivID = "MF" If $DivID = "Macys Home" Then $DivID = "MH" If $DivID = "Macys Merchandising" Then $DivID = "MG" If $DivID = "Macys Northwest" Then $DivID = "MN" If $DivID = "Macys West" Then $DivID = "MW" If $DivID = "Overseas Office" Then $DivID = "OS" If $DivID = "Space" Then $DivID = "SP" $SiteID = (GUICtrlRead($ASiteCombo1)) $PadID = (GUICtrlRead($APadCombo1)) $ClassID = (GUICtrlRead($AClassCombo1)) ; The following section formats the switch model to a 3 character code $ModelID = (GUICtrlRead($AModelCombo1)) If $ModelID = "1900 Switch" Then $ModelID = "S19" If $ModelID = "2900 Switch" Then $ModelID = "S29" If $ModelID = "3500 Switch" Then $ModelID = "S35" If $ModelID = "3700 Switch" Then $ModelID = "S37" ; The following section formats the closet assignment to a 3 character code $ClosetID = (GUICtrlRead($AClosetCombo1)) If $ClosetID = "Computer Room" Then $ClosetID = "CRM" If $ClosetID = "Generic Switch" Then $ClosetID = "STO" If $ClosetID = "POS Room" Then $ClosetID = "POS" If $ClosetID = "RF" Then $ClosetID = "RFQ" $SeriesID = (GUICtrlRead($ASeriesCombo1)) GUICtrlSetData($ASwitchInput1, $DivID & $SiteID & $PadID & $ClassID & $ModelID & $ClosetID & $SeriesID) $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE ExitLoop Case $msg2 = ($Button1) ExitLoop Case $msg2 = ($AClearButton2) _clearChildForm() EndSelect WEnd $tmp = GUICtrlRead($ASwitchInput1) GUIDelete($CiscoNamer) Return $tmp EndFunc ;==>_GuiChild Func _ComboInsertNum2($i_Count = '99', $i_LeadingZeros = '2') Local $i_Data = '' For $i = 1 To $i_Count $i_Data = $i_Data & StringReplace(StringFormat('%' & $i_LeadingZeros & 'g', $i), ' ', '0') & '|' Next Return StringTrimRight($i_Data, 1) EndFunc ;==>_ComboInsertNum2 Func _ComboInsertNum3($i_Count = '100', $i_LeadingZeros = '3') Local $i_Data = '' For $i = 0 To $i_Count $i_Data = $i_Data & StringReplace(StringFormat('%' & $i_LeadingZeros & 'g', $i), ' ', '0') & '|' Next Return StringTrimRight($i_Data, 1) EndFunc ;==>_ComboInsertNum3 Func _clearChildForm() ; clear name fields GUICtrlSetData($ADivCombo1,"") GUICtrlSetData($ASiteCombo1, "") GUICtrlSetData($APadCombo1, "") GUICtrlSetData($AClassCombo1, "") GUICtrlSetData($AModelCombo1, "") GUICtrlSetData($AClosetCombo1, "") GUICtrlSetData($ASeriesCombo1, "") EndFunc ;==>_clearChildForm
  2. Group, Bear with me on this, this is my first time working with child gui's. After looking at the example included with Autoit, I see how the child gui is called from the parent gui. And I think I realize how to make actions happen on the child gui say independent of the parent gui. What I'm curious about, and what I'm working on is a child gui that returns data back to the parent gui, say as a variable. Please see the 2 examples below: Parent gui is listed first #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("AForm1", 282, 441, 192, 113) $Button1 = GUICtrlCreateButton("Switch Name", 24, 24, 73, 25) GUICtrlSetTip(-1, "Start Child Menu") $Input1 = GUICtrlCreateInput("AInput1", 112, 24, 145, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "Returned from ChildGUI") $Button2 = GUICtrlCreateButton("Ok", 24, 80, 73, 25) $Button3 = GUICtrlCreateButton("Exit", 184, 80, 73, 25) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit The 'Switch Name' button from the parent gui needs to call the child gui which is listed Next: #include <GUIConstants.au3> ; == GUI generated with Koda == $CiscoNamer = GUICreate("Cisco Switch Namer", 217, 394, 367, 114) GUICtrlCreateLabel("Division:", 24, 16, 55, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Choose the Division") $ADivCombo1 = GUICtrlCreateCombo("", 88, 16, 105, 21) GUICtrlSetData(-1, "AA|BB|CC") GUICtrlSetTip(-1, "Choose Division") GUICtrlCreateLabel("Site ID:", 24, 56, 46, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Divisional Site ID") $ASiteCombo1 = GUICtrlCreateCombo("", 88, 56, 105, 21) GUICtrlSetData(-1, "000|001|002|003|004|005") GUICtrlSetTip(-1, "Choose Site ID") GUICtrlCreateLabel("Pad ID:", 24, 96, 48, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Choose PAD ID") $APadCombo1 = GUICtrlCreateCombo("", 88, 96, 105, 21) GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P") GUICtrlSetTip(-1, "Choose the site Pad ID") GUICtrlCreateLabel("Class ID:", 24, 136, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Class ID is Fixed") $AClassCombo1 = GUICtrlCreateCombo("", 88, 136, 105, 21) GUICtrlSetData(-1, "N") GUICtrlSetTip(-1, "Class ID Fixed") GUICtrlCreateLabel("Model:", 24, 176, 45, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $AModelCombo1 = GUICtrlCreateCombo("", 88, 176, 105, 21) GUICtrlSetData(-1, "1900|2900|3500|3700") GUICtrlSetTip(-1, "Select Switch Model") GUICtrlCreateLabel("Closet:", 24, 216, 45, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Select the Switch Closet") $AClosetCombo1 = GUICtrlCreateCombo("", 88, 216, 105, 21) GUICtrlSetData(-1, "POS|STO") GUICtrlSetTip(-1, "Select Switch Closet") GUICtrlCreateLabel("Series:", 24, 256, 46, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Switch Series") $ASeriesCombo1 = GUICtrlCreateCombo("", 88, 256, 105, 21) GUICtrlSetData(-1, "01|02|03|04|05") GUICtrlSetTip(-1, "Select Series Switch") $Button1 = GUICtrlCreateButton("OK", 24, 344, 65, 25) GUICtrlSetTip(-1, "Accept Switch Name") $Button2 = GUICtrlCreateButton("Clear", 128, 344, 65, 25) GUICtrlSetTip(-1, "Clear the Form") $ASwitchInput1 = GUICtrlCreateInput("", 24, 296, 169, 24, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetTip(-1, "Switch Name") $DivID = (GUICtrlRead($ADivCombo1)) GUICtrlSetData(-1, $DivID) GUISetState(@SW_SHOW) While 1 $DivID = (GUICtrlRead($ADivCombo1)) $SiteID = (GUICtrlRead($ASiteCombo1)) $PadID = (GUICtrlRead($APadCombo1)) $ClassID = (GUICtrlRead($AClassCombo1)) $ModelID = (GUICtrlRead($AModelCombo1)) $ClosetID = (GUICtrlRead($AClosetCombo1)) $SeriesID = (GUICtrlRead($ASeriesCombo1)) GUICtrlSetData(-1, $DivID & $SiteID & $PadID & $ClassID & $ModelID & $ClosetID & $SeriesID) $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg == ($Button1) MsgBox(4096,"Switch Name", "Switch Name") Case $msg == ($Button2) MsgBox(4096,"Clear Form", "Clear Form") EndSelect WEnd Exit Once the user has selected all of the boxes and the name is in the input box at the bottom, I want that name returned to the parent gui and placed in the 'input box' to the right of switch name when the user presses 'Ok' on the child gui. This will then become a variable to be used later in the actual gui I'm writing. As always, thanks in advance for any help or advice with this. ZenKensei
  3. Group, This is probably pretty quick but I've tried a couple of different pieces of code with no success. I'm looking to create a combo box in a gui and I want it to display a list of numbers, specifically 001 through 100 (using all 3 digits to display). Obviously I could do this the long way and actually add each number such as: GUICtrlSetData(-1, "001|002|003|004") etc. until I get to 100. But i'm sure there should be something similar to: for $i = 001 to 100 but I have not been able to get this to work. hope this makes sense... any help would be appreciated. Thanks ZenKensei
  4. Joe, Yes, its nearly perfect. I found a couple of things that I think were unexpected in your code though. 1) Every time you hit the clear button, it would add an additional listing of VLAN's to the drop down boxes, so if you hit clear twice you then have VLAN1, VLAN10, VLAN20, VLAN30, VLAN40, VLAN1, VLAN10, VLAN30, VLAN40, etc. I believe I have corrected this by modifying line 247 as follows: Old = GuiCtrlSetData(Eval("APort" & $i),$vlanList,$defaultVlan) New = GuiCtrlSetData(Eval("APort" & $i),$defaultVlan) removing the part for adding the $vlanlist each time the clear button is pressed. This seems to work for all of the ports 2 - 23, however, with ports 1 & 24 I seem to be missing some logic, I can't keep the additional VLANs from showing up, and when I press the 'Clear' button the 'Trunking' checkmark box does not default back to a 'checked' state. Seems like I'm missing something on that one. I tried adding the following in the section for clearing ports 1 & 24 but it seems to have no effect. GuiCtrlSetData($ATrunking1,"Trunking Enabled") GUICtrlSetState(-1, $GUI_CHECKED) Let me know if you have any suggestions on this one And again, thanks for taking a look at this in the first place.... ZenKensei
  5. Group, Currently working on a GUI script to help create Cisco switch templates for our Enterprise as part of a large company merger. The script basically allows the user to input basic information about the switch, including name, ip address, etc. as well as VLAN information for each port and then creates a text file named after the switch that can be 'cut & pasted' into the switch via either Hyperterminal or Telnet. I have 3 relatively small problems: 1) I want to be able to 'turn off' or 'block' one control or selection if another one is selected. Specifically, in this script, in the Port1 and Port24 grouping, if the 'Trunking Enabled' checkbox is cleared I want the Combo dropdown boxes to be 'active' but if the 'Trunking Enabled' checkbox is checked I want the Combo dropdown box to be either hidden, greyed out, or otherwise inaccessable. 2) How to show to the user a 'default' selection in the combo boxes for ports 2 - 23 (i.e. I would like the user to see 'VLAN 40' in the box so that if they don't select something different that will be the selected default value) and for VLAN 40 to be the default entry for that control. I have tried a few controls but nothing seems to be visible in all of those boxes when the script runs. 3) I want to be able 'clear' the form after I create the text file template so I can create a additional templates insuring that the settings are back to a 'defaults'. If anyone has time to take a quick look and make some suggestions I would really appreciate it... See the code below: #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("AForm1", 642, 535, 184, 112) $Group1 = GUICtrlCreateGroup("Switch Info", 16, 8, 257, 145) GUICtrlCreateLabel("Switch Name:", 24, 24, 70, 17) GUICtrlSetTip(-1, "Switch Network Name") $ASwitchName = GUICtrlCreateInput("", 96, 24, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. MC002XNS2901") GUICtrlCreateLabel("Switch IP:", 24, 48, 52, 17) GUICtrlSetTip(-1, "Switch IP Address") $ASwitchIP = GUICtrlCreateInput("", 96, 48, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "11.54.333.444") GUICtrlCreateLabel("Switch GWY:", 24, 72, 68, 17) GUICtrlSetTip(-1, "Switch Default Gateway") $ASwitchGWY = GUICtrlCreateInput("", 96, 72, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. 11.54.111.254") GUICtrlCreateLabel("Switch Mask:", 24, 96, 68, 17) GUICtrlSetTip(-1, "Switch Subnet Mask") $ASwitchMask = GUICtrlCreateInput("255.255.254.0", 96, 96, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. 255.255.254.0") GUICtrlCreateLabel("Switch Loc:", 24, 120, 60, 17) GUICtrlSetTip(-1, "Switch Location") $ASwitchLoc = GUICtrlCreateInput("1FL MDF Rack 1 Position 1", 96, 120, 161, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. 1FL - MDF Rack 1") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetTip(-1, "General Switch Info") $Group2 = GUICtrlCreateGroup("Port 1 Configuration", 288, 8, 161, 145) $ATrunking1 = GUICtrlCreateCheckbox("Trunking Enabled", 304, 32, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, " FA0/1 Trunking On") $APortFast1 = GUICtrlCreateCheckbox("PortFast Enabled", 304, 56, 121, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "FA0/1 PortFast Spanning") $APort1 = GUICtrlCreateCombo("", 304, 120, 113, 21) GUICtrlSetData(-1, "TRUNK|VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "VLAN Access Mode") $ASpeed1 = GUICtrlCreateCheckbox("100Mb / Full Duplex", 304, 80, 129, 17) GUICtrlSetTip(-1, "Set Speed to 100mb / Full Duplex") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetTip(-1, "FA0/1 Config") $Group3 = GUICtrlCreateGroup("Port 24 Configuration", 464, 8, 161, 145) $ATrunking24 = GUICtrlCreateCheckbox("Trunking Enabled", 480, 32, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "FA0/24 Trunking On") $APortFast24 = GUICtrlCreateCheckbox("PortFast Enabled", 480, 56, 105, 17) ; GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "FA0/24 PortFast Spanning") $APort24 = GUICtrlCreateCombo("", 480, 120, 113, 21) GUICtrlSetData(-1, "TRUNK|VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "VLAN Access Mode") $ASpeed24 = GUICtrlCreateCheckbox("100Mb / Full Duplex", 480, 80, 129, 17) GUICtrlSetTip(-1, "Set Speed to 100mb / Full Duplex") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetTip(-1, "Port 24 Uplink Config") $Group4 = GUICtrlCreateGroup("Standard Port Configuration", 16, 232, 609, 233) GUICtrlCreateLabel("Port FA0/2", 32, 256, 56, 17) GUICtrlSetTip(-1, "FA0/2 VLAN Access") $APort2 = GUICtrlCreateCombo("", 32, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 2 VLAN Access") GUICtrlCreateLabel("Port FA0/3", 32, 304, 56, 17) GUICtrlSetTip(-1, "FA0/3 VLAN Access") $APort3 = GUICtrlCreateCombo("", 32, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 3 VLAN Access") GUICtrlCreateLabel("Port FA0/4", 32, 352, 56, 17) GUICtrlSetTip(-1, "FA0/4 VLAN Access") $APort4 = GUICtrlCreateCombo("", 32, 368, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 4 VLAN Access") GUICtrlCreateLabel("Port FA0/5", 32, 400, 56, 17) GUICtrlSetTip(-1, "FA0/5 VLAN Access") $APort5 = GUICtrlCreateCombo("", 32, 416, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 5 VLAN Access") GUICtrlCreateLabel("Port FA0/6", 128, 256, 56, 17) GUICtrlSetTip(-1, "FA0/6 VLAN Access") $APort6 = GUICtrlCreateCombo("", 128, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 6 VLAN Access") GUICtrlCreateLabel("Port FA0/7", 128, 304, 56, 17) GUICtrlSetTip(-1, "FA0/7 VLAN Access") $APort7 = GUICtrlCreateCombo("", 128, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 7 VLAN Access") GUICtrlCreateLabel("Port FA0/8", 128, 352, 56, 17) GUICtrlSetTip(-1, "FA0/8 VLAN Access") $APort8 = GUICtrlCreateCombo("", 128, 368, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 8 VLAN Access") GUICtrlCreateLabel("Port FA0/9", 128, 400, 56, 17) GUICtrlSetTip(-1, "FA0/9 VLAN Access") $APort9 = GUICtrlCreateCombo("", 128, 416, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 9 VLAN Access") GUICtrlCreateLabel("Port FA0/10", 224, 256, 62, 17) GUICtrlSetTip(-1, "FA0/10 VLAN Access") $APort10 = GUICtrlCreateCombo("", 224, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 10 VLAN Access") GUICtrlCreateLabel("Port FA0/11", 224, 304, 62, 17) GUICtrlSetTip(-1, "FA0/11 VLAN Access") $APort11 = GUICtrlCreateCombo("", 224, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlCreateLabel("Port FA0/12", 224, 352, 62, 17) GUICtrlSetTip(-1, "FA0/12 VLAN Access") $APort12 = GUICtrlCreateCombo("", 224, 368, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlCreateLabel("Port FA0/13", 224, 400, 62, 17) GUICtrlSetTip(-1, "FA0/13 VLAN Access") $APort13 = GUICtrlCreateCombo("", 224, 416, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlCreateLabel("Port FA0/14", 328, 256, 62, 17) GUICtrlSetTip(-1, "FA0/14 VLAN Access") $APort14 = GUICtrlCreateCombo("", 328, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 14 VLAN Access") GUICtrlCreateLabel("Port FA0/15", 328, 304, 62, 17) GUICtrlSetTip(-1, "FA0/15VLAN Access") $APort15 = GUICtrlCreateCombo("", 328, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 15 VLAN Access") GUICtrlCreateLabel("Port FA0/16", 328, 352, 62, 17) GUICtrlSetTip(-1, "FA0/16 VLAN Access") $APort16 = GUICtrlCreateCombo("", 328, 368, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 16 VLAN Access") GUICtrlCreateLabel("Port FA0/17", 328, 400, 62, 17) GUICtrlSetTip(-1, "FA0/17 VLAN Access") $APort17 = GUICtrlCreateCombo("", 328, 416, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 17 VLAN Access") GUICtrlCreateLabel("Port FA0/18", 432, 256, 62, 17) GUICtrlSetTip(-1, "FA0/18 VLAN Access") $APort18 = GUICtrlCreateCombo("", 432, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 18 VLAN Access") GUICtrlCreateLabel("Port FA0/19", 432, 304, 62, 17) GUICtrlSetTip(-1, "FA0/19 VLAN Access") $APort19 = GUICtrlCreateCombo("", 432, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 19 VLAN Access") GUICtrlCreateLabel("Port FA0/20", 432, 352, 62, 17) GUICtrlSetTip(-1, "FA0/20 VLAN Access") $APort20 = GUICtrlCreateCombo("", 432, 368, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 20 VLAN Access") GUICtrlCreateLabel("Port FA0/21", 432, 400, 62, 17) GUICtrlSetTip(-1, "FA0/21 VLAN Access") $APort21 = GUICtrlCreateCombo("", 432, 416, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 21 VLAN Access") GUICtrlCreateLabel("Port FA0/22", 528, 256, 62, 17) GUICtrlSetTip(-1, "FA0/22 VLAN Access") $APort22 = GUICtrlCreateCombo("", 528, 272, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 22 VLAN Access") GUICtrlCreateLabel("Port FA0/23", 528, 304, 62, 17) GUICtrlSetTip(-1, "FA0/23 VLAN Access") $APort23 = GUICtrlCreateCombo("", 528, 320, 73, 21) GUICtrlSetData(-1, "VLAN 1|VLAN 10|VLAN 20|VLAN 30|VLAN 40") GUICtrlSetTip(-1, "Port 23 VLAN Access") GUICtrlCreateLabel("", 528, 352, 4, 4) GUICtrlCreateLabel("All ports are auto", 528, 352, 83, 17) GUICtrlCreateLabel("speed and duplex.", 528, 368, 91, 17) GUICtrlCreateLabel("All ports are", 528, 384, 59, 17) GUICtrlCreateLabel("VLAN 40 by", 528, 400, 61, 17) GUICtrlCreateLabel("default.", 528, 416, 39, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetTip(-1, "FA0/2 - FA0/23 Configs") $Button1 = GUICtrlCreateButton("Write Config File", 136, 480, 97, 25) GUICtrlSetTip(-1, "Create config file") $Button2 = GUICtrlCreateButton("Clear Form", 272, 480, 97, 25) GUICtrlSetTip(-1, "Clear the form") $Button3 = GUICtrlCreateButton("Exit", 408, 480, 81, 25) GUICtrlSetTip(-1, "Exit Application") $Group5 = GUICtrlCreateGroup("VTP Information", 16, 160, 257, 65) GUICtrlCreateLabel("VTP Domain:", 24, 176, 67, 17) GUICtrlSetTip(-1, "VTP Domain Name") $AVTPDomain = GUICtrlCreateInput("", 104, 176, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. FLO700X") GUICtrlCreateLabel("VTP Password:", 24, 200, 77, 17) GUICtrlSetTip(-1, "VTP Server Password") $AVTPPassword = GUICtrlCreateInput("", 104, 200, 105, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "ex. FLO700X") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetTip(-1, "VTP Server Info") ; GUISetState(@SW_SHOW) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_Close $msg = GUIGetMsg() Select Case $msg = ($Button1) _WriteConfig(GUICtrlRead($ASwitchName)) Case $msg = ($Button3) MsgBox(0, "EXIT", "Exiting Cisco Config", 2) Exit EndSelect WEnd Exit Func _WriteConfig($ASwitchName) $SwitchName = $ASwitchName $IPAddress = (GUICtrlRead($ASwitchIP)) $Gateway = (GUICtrlRead($ASwitchGWY)) $SubnetMask = (GUICtrlRead($ASwitchMask)) $VTPDomain = (GUICtrlRead($AVTPDomain)) $VTPPassword = (GUICtrlRead($AVTPPassword)) $Trunking1 = (GUICtrlRead($ATrunking1)) $PortFast1 = (GUICtrlRead($APortFast1)) $Speed1 = (GUICtrlRead($ASpeed1)) $Port1 = (GUICtrlRead($APort1)) $Trunking24 = (GUICtrlRead($ATrunking24)) $PortFast24 = (GUICtrlRead($APortFast24)) $Speed24 = (GUICtrlRead($ASpeed24)) $Port24 = (GUICtrlRead($APort24)) If $SwitchName <> "" And $IPAddress <> "" And $Gateway <> "" Then $Port1 = (GUICtrlRead($APort1)) If $Port1 = "" Then $Port1 = ("TRUNK") $Trunking1 = (GUICtrlRead($ATrunking1)) $PortFast1 = (GUICtrlRead($APortFast1)) $Speed1 = (GUICtrlRead($ASpeed1)) $Port2 = (GUICtrlRead($APort2)) If $Port2 = "" Then $Port2 = ("VLAN 40") $Port3 = (GUICtrlRead($APort3)) If $Port3 = "" Then $Port3 = ("VLAN 40") $Port4 = (GUICtrlRead($APort4)) If $Port4 = "" Then $Port4 = ("VLAN 40") $Port5 = (GUICtrlRead($APort5)) If $Port5 = "" Then $Port5 = ("VLAN 40") $Port6 = (GUICtrlRead($APort6)) If $Port6 = "" Then $Port6 = ("VLAN 40") $Port7 = (GUICtrlRead($APort7)) If $Port7 = "" Then $Port7 = ("VLAN 40") $Port8 = (GUICtrlRead($APort8)) If $Port8 = "" Then $Port8 = ("VLAN 40") $Port9 = (GUICtrlRead($APort9)) If $Port9 = "" Then $Port9 = ("VLAN 40") $Port10 = (GUICtrlRead($APort10)) If $Port10 = "" Then $Port10 = ("VLAN 40") $Port11 = (GUICtrlRead($APort11)) If $Port11 = "" Then $Port11 = ("VLAN 40") $Port12 = (GUICtrlRead($APort12)) If $Port12 = "" Then $Port12 = ("VLAN 40") $Port13 = (GUICtrlRead($APort13)) If $Port13 = "" Then $Port13 = ("VLAN 40") $Port14 = (GUICtrlRead($APort14)) If $Port14 = "" Then $Port14 = ("VLAN 40") $Port15 = (GUICtrlRead($APort15)) If $Port15 = "" Then $Port15 = ("VLAN 40") $Port16 = (GUICtrlRead($APort16)) If $Port16 = "" Then $Port16 = ("VLAN 40") $Port17 = (GUICtrlRead($APort17)) If $Port17 = "" Then $Port17 = ("VLAN 40") $Port18 = (GUICtrlRead($APort18)) If $Port18 = "" Then $Port18 = ("VLAN 40") $Port19 = (GUICtrlRead($APort19)) If $Port19 = "" Then $Port19 = ("VLAN 40") $Port20 = (GUICtrlRead($APort20)) If $Port20 = "" Then $Port20 = ("VLAN 40") $Port21 = (GUICtrlRead($APort21)) If $Port21 = "" Then $Port21 = ("VLAN 40") $Port22 = (GUICtrlRead($APort22)) If $Port22 = "" Then $Port22 = ("VLAN 40") $Port23 = (GUICtrlRead($APort23)) If $Port23 = "" Then $Port23 = ("VLAN 40") $Port24 = (GUICtrlRead($APort24)) If $Port24 = "" Then $Port24 = ("TRUNK") $Trunking24 = (GUICtrlRead($ATrunking24)) $PortFast24 = (GUICtrlRead($APortFast24)) $Speed24 = (GUICtrlRead($ASpeed24)) MsgBox(4096, "Switch Name", "Switch Network Name is: " & $SwitchName, 2) MsgBox(4096, "IP Address", "Switch Gateway IP Address is: " & $IPAddress, 2) ; MsgBox(4096, "Defualt Gateway", "Switch Gateway IP Address is: " & $Gateway, 2) ; MsgBox(4096, "Subnet Mask", "Switch Subnet Mask is: " & $SubnetMask, 2) ; MsgBox(4096, "VTP Domain", "Switch VTP Domain is: " & $VTPDomain, 2) ; MsgBox(4096, "VTP Password", "Switch VTP Password is: " & $VTPPassword, 2) MsgBox(4096, "Port FA0/1", "Port FA0/1 Trunking is: " & $Trunking1) MsgBox(4096, "Port FA0/1", "Port FA0/1 Spanning is: " & $PortFast1) MsgBox(4096, "Port FA0/1", "Port FA0/1 Speed is: " & $Speed1) MsgBox(4096, "Port FA0/1", "Port FA0/1 VLAN is: " & $Port1) MsgBox(4096, "Port FA0/24", "Port FA0/24 Trunking is: " & $Trunking24) MsgBox(4096, "Port FA0/24", "Port FA0/24 Spanning is: " & $PortFast24) MsgBox(4096, "Port FA0/24", "Port FA0/24 Speed is: " & $Speed24) MsgBox(4096, "Port FA0/24", "Port FA0/24 VLAN is: " & $Port24) If FileExists(@ScriptDir & "\" & $SwitchName & ".txt") Then FileDelete(@ScriptDir & "\" & $SwitchName & ".txt") $SwitchFile = FileOpen(@ScriptDir & "\" & $SwitchName & ".txt", 1) ; Check if file opened for writing OK If $SwitchFile = -1 Then MsgBox(0, "Error", "Unable to open logfile.") Exit EndIf ; The following 4 lines write general switch information to the config file. ; Rem these lines out or do not 'cut' them to be pasted. FileWrite($SwitchFile, "Switch Name: " & $SwitchName & @CRLF) FileWrite($SwitchFile, "IP Address: " & $IPAddress & @CRLF) FileWrite($SwitchFile, "Gateway: " & $Gateway & @CRLF) FileWrite($SwitchFile, "Subnet Mask: " & $SubnetMask & @CRLF) FileWrite($SwitchFile, @CRLF) ; The following section is the 'header section of the switch config. ; This information is always the same for configs created with this application. FileWrite($SwitchFile, "vlan database" & @CRLF) FileWrite($SwitchFile, "vtp mode client" & @CRLF) FileWrite($SwitchFile, "VTP DOMAIN " & $VTPDomain & @CRLF) FileWrite($SwitchFile, "vtp V2-MODE" & @CRLF) FileWrite($SwitchFile, "VTP PASSWORD " & $VTPPassword & @CRLF) FileWrite($SwitchFile, "EXIT" & @CRLF) ; Downlink Port 1 - Default Trunk Port For Switch to Switch Connection ; This port is used for connection to 'lower' switches (i.e. 2900's, 1900's, etc) If $Port1 = ("Trunk") Then FileWrite($SwitchFile, "interface FastEthernet0/1" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT TRUNK ENCAP DOT1Q" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT MODE TRUNK" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) Else FileWrite($SwitchFile, "interface FastEthernet0/1" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port1 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) EndIf If $Speed1 = 1 Then FileWrite($SwitchFile, "speed 100" & @CRLF) FileWrite($SwitchFile, "duplex full" & @CRLF) EndIf ; The following section starts the actual Port config for FA0/2 - FA0/23 FileWrite($SwitchFile, "interface FastEthernet0/2" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port2 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/3" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port3 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/4" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port4 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/5" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port5 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/6" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port6 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/7" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port7 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/8" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port8 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/9" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port9 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/10" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port10 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/11" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port11 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/12" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port12 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/13" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port13 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/14" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port14 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/15" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port15 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/16" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port16 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/17" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port17 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/18" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port18 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/19" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port19 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/20" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port20 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/21" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port21 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/22" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port22 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) FileWrite($SwitchFile, "interface FastEthernet0/23" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port23 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) ; UpLink Port 24 - Default Trunk Port For Switch to Switch Connection ; This port is used for connection to 'higher' switches (i.e. 3560's, etc) If $Port24 = ("Trunk") Then FileWrite($SwitchFile, "interface FastEthernet0/24" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT TRUNK ENCAP DOT1Q" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT MODE TRUNK" & @CRLF) Else FileWrite($SwitchFile, "interface FastEthernet0/24" & @CRLF) FileWrite($SwitchFile, "SWITCHPORT ACCESS " & $Port24 & @CRLF) FileWrite($SwitchFile, "switchport mode access" & @CRLF) FileWrite($SwitchFile, "spanning-tree portfast" & @CRLF) FileWrite($SwitchFile, "cdp enable" & @CRLF) EndIf If $Speed24 = 1 Then FileWrite($SwitchFile, "speed 100" & @CRLF) FileWrite($SwitchFile, "duplex full" & @CRLF) EndIf FileWrite($SwitchFile, "" & @CRLF) FileWrite($SwitchFile, "" & @CRLF) ; The following section completes the switch config file. FileWrite($SwitchFile, "interface Vlan1" & @CRLF) FileWrite($SwitchFile, "no ip address" & @CRLF) FileWrite($SwitchFile, "no ip route-cache" & @CRLF) FileWrite($SwitchFile, "shutdown" & @CRLF) FileWrite($SwitchFile, "!" & @CRLF) FileWrite($SwitchFile, "INTERFACE VLAN 10" & @CRLF) FileWrite($SwitchFile, "ip address " & $IPAddress & " " & $SubnetMask & @CRLF) FileWrite($SwitchFile, "" & @CRLF) FileWrite($SwitchFile, "no ip route-cache" & @CRLF) FileWrite($SwitchFile, "!" & @CRLF) FileWrite($SwitchFile, "IP DEFAULT-GATEWAY " & $Gateway & @CRLF) FileWrite($SwitchFile, "Managed Hostname: " & $SwitchName & @CRLF) FileClose($SwitchFile) ElseIf $SwitchName = "" Or $IPAddress = "" Or $Gateway = "" Then MsgBox(4096, "Missing Information", "You must first enter Switch Name, IP Address & Default Gateway", 5) EndIf EndFunc ;==>_WriteConfig I'm sure it could be shorter and cleaner, but it works... As always, thanks in advance for any advice or help! ZenKensei
  6. Group, Just wondered whether anyone has tried this or may have some idea of whether Autoit is actually the best way to do this. I would like to script the changing or setting of the screen resolution on multiple PC's. For instance, if the PC is currently set for 800x600 with 24bit color could I script a change to 1024x768 with 24bit (1024x768x24). I assumed this would be fairly easy, however a search using Google groups doesn't really bring back a lot of hits on scripting a change, there are hits about determing the current resolution, but not on changing it. Am I correct assuming this is not as simple as making a registry change or something similar? I would like to keep it totally self-contained as an AutoIT script, but I'm open to suggestions. Thanks, ZK
  7. LxP, DOH!!! Yes, that worked. It seems I overlooked the obvious and was trying to make the task to difficult for my own good. Thanks my friend, for bringing a fresh set of eyes and additional brain cells to the problem.... ZK
  8. Group, Working on a script where I need to set certain permissions within the registry to limit the changes the logged on users can make (creating a 'kiosk' type environment). There have been several post concerning two different programs, SetACL and Regperm (http://homepages.cae.wisc.edu/~micro/regperm/). I have a batch file that runs Regperm without issue, and since the only permission changes I need to make are to the registry and the Regperm application is roughly 1/4 the size of SetACL I would like use Regperm. That being said, I cannot seem to get Regperm to work with a direct Run or Runwait command from Autoit. I've tried multiple combinations of double quotes, @Comspec, etc. and nothing seems to work. Yes, I can compile the application and the batch file and then have Autoit simply call the batch file, but now its gotten a little personal, I just want to see how a direct call would work. Below is the command line from my working batch file (and the only line in the file): regperm.exe /K "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGONTEST" /A:"Users":F /E I created the registry key HKLM\Software\Microsoft\Windows NT\Currentversion\Winlogontest to use for testing, the real key, once working will be HKLM\Software\Microsoft\Windows NT\Currentversion\Winlogon. If anyone can help out with this I would appreciate it, I'm all out of ideas. Thanks in advance, ZK
  9. Fredr1ck, JS is right, it should be fairly simple to do. The one problem that you will need to watch out for, that is really no fault of AutoIt, is the timing during the actual logon process. Since you will be reading and writing to a remote sharepoint, as well as trying to authenticate a specific domain user account for the 'RunAs' function, I would suggest you make the Autoit routine one of the last entries in your logon script. It seems like I have some code snippets around somewhere that do something similar to what your looking for, if I have a chance I will dig those up after work and see if they help you out. ZK
  10. Sorry for the oversight JS, the actual code I tried was just a simple one line code of: FileRecycleEmpty() or FileRecycleEmpty("C:\") Both of these worked as expected in Windows XP (and I assume it would in Windows 2000, though I do not have a Win2k workstation to test it on). However when I run the code on my Windows NT 4.0 workstation with IE 5.5 it does not empty the recycle bin and yet I receive no errors. Thanks, ZK
  11. Group, Maybe I missed something in the help file, but I cannot get the FileRecycleEmpty function to work on a Windows NT 4.0 workstation with Internet Explorer 5.5 installed. I have tried specifying the drive directly and leaving the drive designation out completely. The same commands work on Windows XP without issue. Am I missing something here?? Is there a work around for this? Thanks, ZK
  12. Group, I'm working on a script to automate the uninstall of an application. The application can only be uninstalled via the local administrator account and since I can't give this out to the user community, I was writing the script to use 'Runas' and then run the commands that are listed for this application in the registry. There is one key that I'm unsure of due to the number and usage of parameters, I could use a second set of eyes to make sure the syntax is correct. Below is the actual registry entry as it appears within the uninstall section: C:\WINDOWS\Uninst.exe -a -f"C:\Program Files\UMS\DeIsL1.isu" -c"C:\Program Files\UMS\UI32DLLB.DLL" Below is my code for handling it (and a few other lines): RunAsSet("Administrator", @Computername, "Admin") RunWait("C:\WINDOWS\Uninst.exe " & " -a -f C:\Program Files\UMS\DeIsL1.isu -c C:\Program Files\UMS\UI32DLLB.DLL",,@SW_HIDE) ProcessClose("ums*") ProcessClose("dllinit*") ProcessClose("SHUTUSR") RunWait(@ComSpec & " /c " & 'winmgmt /kill', "", @SW_HIDE) RunAsSet() The machines that I'm writing this for are all laptops for remote users, so I have no way to really test it and play with the code. The application is one of IBM's UMS management app's and has been known to cause issues due to memory leaks. Also, if anyone has had some experience with automating the uninstall of applications located within the Add/Remove programs applet, please feel free to pass along any tips you may have. As always, thanks in advance. ZK
  13. Group, I'm still trying to understand some of the process flow of the GUI controls. I have a simple (least I think it should be simple) script that I'm working on below. It has 2 radio buttons, 1 input line, and 3 standard buttons. What I'm looking for is as follows: Only 1 radio button pressed at a time (this becomes a variable), the input becomes a variable, and then this information is passed to a function based on the 1 of the 3 standard buttons that is pressed. What I'm having problems with is how to have only one radio button able to be pressed in the group, and how to insure that a radio button has been selected and that input has been entered when one of the 3 standard buttons are pressed. #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("MyGUI", 392, 448,(@DesktopWidth-392)/2, (@DesktopHeight-448)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Group_1 = GuiCtrlCreateGroup("Group1", 60, 90, 270, 50) $Radio_2 = GuiCtrlCreateRadio("Desktop", 90, 110, 80, 20) $Radio_3 = GuiCtrlCreateRadio("Laptop", 210, 110, 90, 20) $Input_4 = GuiCtrlCreateInput("", 130, 170, 140, 20) $Button_5 = GuiCtrlCreateButton("Division 1", 70, 250, 90, 30) $Button_6 = GuiCtrlCreateButton("Division 2", 230, 250, 90, 30) $Button_7 = GuiCtrlCreateButton("Division 3", 150, 310, 90, 30) $Close = GuiCtrlCreateButton("Exit", 150, 380, 90, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = ($Button_5) _Division1($Input_4) Case $msg = ($Button_6) _Division2($Input_4) Case $msg = ($Button_7) _Division3($Input_4) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Close MsgBox(0, "EXIT", "Exiting Pre-Stage Application", 2) Exit EndSelect WEnd;;; Exit Func _Division1($Input_4) MsgBox(0,"Divsion 1", "Division 1 Button Pressed " & $Input_4,5) EndFunc Func _Division2($Input_4) MsgBox(0,"Division 2", "Division 2 Button Pressed " & $Input_4,5) EndFunc Func _Division3($Input_4) MsgBox(0,"Division 3", "Division 3 Button Pressed " & $Input_4,5) EndFunc So if the user selects the 'Desktop' radio button, and then inputs '1234567' as the input (asset tag), this is passed to the function when 1 of the standard buttons is pressed. But there is no action unless a radio button is pressed AND there is input information. Any help would be appreciated as always. Thanks, ZK
  14. Group, Just curious about the correct way to switch tabs using the 'Control' functionality. Specifically within the Power Options window of the Windows XP control panel (i.e. Powercfg.cpl). I have the following script that changes certain settings for a specific type of computer, such as a kiosk based device. Opt ("WinWaitDelay", 10) Opt ("WinTitleMatchMode", 4) Opt ("WinDetectHiddenText", 1) Opt ("MouseCoordMode", 0) Run('rundll32.exe shell32.dll,Control_RunDLL Powercfg.cpl', @SystemDir, @SW_HIDE) WinWait("Power Options Properties", "Select the power sch") ControlHide("Power Options Properties", "Power Schemes", 1007) ControlCommand("Power Options Properties", "", "ComboBox1", "SetCurrentSelection", 3) ControlCommand("Power Options Properties", "", "ComboBox2", "SetCurrentSelection", 15) ControlCommand("Power Options Properties", "", "ComboBox3", "SetCurrentSelection", 6) ControlClick('Power Options Properties', '', 'Button5') Exit However I also want to turn off the Hibernation option on the Hibernate tab. What is the correct way to make the Hibernate tab the active tab (or to change to any other tab) in order to change settings? I looked at ControlSend in the help file but was curious if there is not a more direct way to change focus to that tab then performing a series of ControlSend ("{TAB 9}"). Thanks in advance, ZK
  15. Group, Could use a little assistance or advice with a problem at work. Our company is in the process of merging internal divisions, and as such want to standardize and eliminate references to the old divisions. In the past we have used 3 digit identifiers for each division as a way to tell at a glance what division a document or file is referring to. I would like to be able to create an Autoit script that would do a recursive search through a directory and replace a specific 3 digit string in a file name with a new 3 digit string, example: ABC Financials.xls would become XYZ Financials.xls For the sake of being able to rename the file back if necessary due to a link from somewhere else, it would be nice to have a log file created that says: Old file= ABC Financials.xls New file= XYZ Financials.xls and the folder the file was located in. I'm familiar with doing simple search and replaces for strings in a file name, but not with the logic of a recursive search through an entire directory structure, then piping the files to a log file. As always, thanks in advance... ZK
×
×
  • Create New...