Sign in to follow this  
Followers 0
gseller

Telnet Switchboard For Hummingbird

6 posts in this topic

Not sure if this will be of interest to anyone, just thought I would share. I have been working on this for some time and most of the code is from bits and peices scavaged from the fgreat works of others. I don't have time to go back and give credit to all that have contributed. If you see code that you have pioneered feel free to leave a comment. I for sure share credit with everyone and apreciate all the help I rcvd. I had a post on this in the help section but since it is ready now I an posting here. So, with all this said here it is.

Feedback is apreciated...

Switchboard.au3

#NoTrayIcon
   #include <GUIConstants.au3>
   
  ;Set HotKeys
   HotKeySet("{PGUP}", "Show")
   HotKeySet("{PGDN}", "Hide")
   
   Dim $Profile = " -P "
   Dim $Host = " -H "
   
   $GUI_W = "633";Absolute GUI Width
   $GUI_H = "447";Absolute GUI Height
   $laHors = "8"    ;horizontal positioning of Local Admin group box
   $laVert = "140"  ;vertical positioning of Local Admin group box
   $laHorsBut = "88";horzontal button positioning compared to Local Admin group box & used as multable
   $laVertBut = "30";vertical button positioning compared to Local Admin group box & used as multable
   $laButSize = "75, 25";Size of buttons in Local Admin group box
   #Region ### START Koda GUI section ### Form=
   $hGui = GUICreate("Switchboard", $GUI_W, $GUI_H, (@DesktopWidth-$GUI_W)/10, (@DesktopHeight-$GUI_H)/10)
   Opt("GuiOnEventMode", 1)
   $Tab1 = GUICtrlCreateTab(16, 40, 601, 337)
   $TabSheet1 = GUICtrlCreateTabItem("INTRO")
   GUICtrlCreateLabel("Please choose a TAB to find your ", 10, 10, 450, 20, $SS_Left)
   $Edit1 = GUICtrlCreateEdit("", 40, 88, 537, 257)
   GUICtrlSetData(-1, StringFormat("This is where you can put your custom instructions\r\nDeveloped by: can go here\r\n\r\nThis demonstrates skipping a line in your text."))
   GUICtrlSetBkColor(-1, 0xD8E4F8)
   GUICtrlSetTip(-1, "You must click on a tab to launch a switch")
  ;------------------------------------------------------------------------
   $TabSheet2 = GUICtrlCreateTabItem("Section 1")
  ; Here is the setup for APAC TAB
   
   GUICtrlCreateGroup("Section 1 Telnet Switches", $laHors * 3, $laVert / 2, 585, 315)
   GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
   GUICtrlCreateLabel("Choose A Section 1 Telnet Switch To Open", 10, 10, 450, 20, $SS_Left)
   $IniFile = @ScriptDir & '\IP.ini'
   $avSwitches = IniReadSection($IniFile, "section1")
   If @error Or $avSwitches[0][0] = 0 Then
       MsgBox(16, "Error", "Error reading ini file, or no data.")
   Else
       $h = 0
       $v = 0
   For $n = 1 To $avSwitches[0][0]
       $avSwitches[$n][0] = GUICtrlCreateRadio($avSwitches[$n][0], 95 + $laHors + $laHorsBut * $h, -50 + $laVert + $laVertBut * $v, $laButSize)
               $h = $h + 1
               if $h > 4 Then
                   $h = 0
                   $v = $v + 1
               EndIf
   GUICtrlSetOnEvent(-1, "_section1")
   Next
   EndIf
  ;------------------------------------------------------------------------
   $TabSheet3 = GUICtrlCreateTabItem("Section 2")
  ; Here is the setup for APAC TAB
   
   GUICtrlCreateGroup("Section 2 Telnet Switches", $laHors * 3, $laVert / 2, 585, 315)
   GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
   GUICtrlCreateLabel("Choose A Section 2 Telnet Switch To Launch", 10, 10, 450, 20, $SS_Left)
   $IniFile = @ScriptDir & '\IP.ini'
   $avSwitches1 = IniReadSection($IniFile, "section2")
   If @error Or $avSwitches1[0][0] = 0 Then
       MsgBox(16, "Error", "Error reading ini file, or no data.")
   Else
       $h = 0
       $v = 0
   For $n = 1 To $avSwitches1[0][0]
       $avSwitches1[$n][0] = GUICtrlCreateRadio($avSwitches1[$n][0], 95 + $laHors + $laHorsBut * $h, -50 + $laVert + $laVertBut * $v, $laButSize)
               $h = $h + 1
               if $h > 4 Then
                   $h = 0
                   $v = $v + 1
               EndIf
   GUICtrlSetOnEvent(-1, "_section2")
   Next
   EndIf
  ;------------------------------------------------------------------------
   $TabSheet4 = GUICtrlCreateTabItem("Section3")
  ; Here is the setup for APAC TAB
   
   GUICtrlCreateGroup("Section 3 Telnet Switches", $laHors * 3, $laVert / 2, 585, 315)
   GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
   GUICtrlCreateLabel("Choose A Section 3 Telnet Switch To Launch", 10, 10, 450, 20, $SS_Left)
   $IniFile = @ScriptDir & '\IP.ini'
   $avSwitches2 = IniReadSection($IniFile, "section3")
   If @error Or $avSwitches2[0][0] = 0 Then
       MsgBox(16, "Error", "Error reading ini file, or no data.")
   Else
       $h = 0
       $v = 0
   For $n = 1 To $avSwitches2[0][0]
       $avSwitches2[$n][0] = GUICtrlCreateRadio($avSwitches2[$n][0], 95 + $laHors + $laHorsBut * $h, -50 + $laVert + $laVertBut * $v, $laButSize)
               $h = $h + 1
               if $h > 4 Then
                   $h = 0
                   $v = $v + 1
               EndIf
   GUICtrlSetOnEvent(-1, "_section3")
   Next
   EndIf
  ;------------------------------------------------------------------------
   $TabSheet5 = GUICtrlCreateTabItem("Section 4")
  ; Here is the setup for APAC TAB
   
   GUICtrlCreateGroup("Section 4 Telnet Switches", $laHors * 3, $laVert / 2, 585, 315)
   GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
   GUICtrlCreateLabel("Choose A Section 4 Telnet Switch To Launch", 10, 10, 450, 20, $SS_Left)
   $IniFile = @ScriptDir & '\IP.ini'
   $avSwitches3 = IniReadSection($IniFile, "section4")
   If @error Or $avSwitches3[0][0] = 0 Then
       MsgBox(16, "Error", "Error reading ini file, or no data.")
   Else
       $h = 0
       $v = 0
   For $n = 1 To $avSwitches3[0][0]
       $avSwitches3[$n][0] = GUICtrlCreateRadio($avSwitches3[$n][0], 95 + $laHors + $laHorsBut * $h, -50 + $laVert + $laVertBut * $v, $laButSize)
               $h = $h + 1
               if $h > 4 Then
                   $h = 0
                   $v = $v + 1
               EndIf
   GUICtrlSetOnEvent(-1, "_section4")
   Next
   EndIf
  ;------------------------------------------------------------------------
   $TabSheet5 = GUICtrlCreateTabItem("Section 5")
  ; Here is the setup for APAC TAB
   
   GUICtrlCreateGroup("Section 5 Telnet Switches", $laHors * 3, $laVert / 2, 585, 315)
   GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
   GUICtrlCreateLabel("Choose A Section 5 Telnet Switch To Launch", 10, 10, 450, 20, $SS_Left)
   $IniFile = @ScriptDir & '\IP.ini'
   $avSwitches4 = IniReadSection($IniFile, "section5")
   If @error Or $avSwitches4[0][0] = 0 Then
       MsgBox(16, "Error", "Error reading ini file, or no data.")
   Else
       $h = 0
       $v = 0
   For $n = 1 To $avSwitches4[0][0]
       $avSwitches4[$n][0] = GUICtrlCreateRadio($avSwitches4[$n][0], 95 + $laHors + $laHorsBut * $h, -50 + $laVert + $laVertBut * $v, $laButSize)
               $h = $h + 1
               if $h > 4 Then
                   $h = 0
                   $v = $v + 1
               EndIf
   GUICtrlSetOnEvent(-1, "_section5")
   Next
   EndIf
  ;------------------------------------------------------------------------
   
   
   GUICtrlSetState(-1,$GUI_SHOW)
   GUICtrlCreateTabItem("")
   GUICtrlCreateGroup("", -99, -99, 1, 1)
   GUISetState(@SW_SHOW)
   #EndRegion ### END Koda GUI section ###
   Dim $MenuFile = @ScriptDir & '\Menu.ini', $ItemEventsArr[1][1]
   _GUICtrlCreateCustomMenu($MenuFile, $ItemEventsArr)
   
   
   While 1
       Sleep(20)
   WEnd
   Func Show()
       GUISetState(@SW_SHOW, $hGui)
   EndFunc
   
   Func Hide()
       GUISetState(@SW_HIDE, $hGui)
   EndFunc
   Func _section1()
       For $n = 1 To $avSwitches[0][0]
           If ControlCommand($hGui, "", $avSwitches[$n][0], "IsChecked") Then
              ;ShellExecute("HOSTEX32.EXE", " " & $avSwitches[$n][1],@ProgramFilesDir & "\Hummingbird\Connectivity\10.00\HostExplorer", "",)
               MsgBox(64, "Results", 'Running: ShellExecute("terminal.exe", ' & $avSwitches[$n][1] & ', "%PROGRAMFILES%\HostExplorer\", "",)')
           EndIf
       Next
   EndFunc  ;==>_OK
   Func _section2()
       For $n = 1 To $avSwitches1[0][0]
           If ControlCommand($hGui, "", $avSwitches1[$n][0], "IsChecked") Then
              ;ShellExecute("HOSTEX32.EXE", " " & $avSwitches1[$n][1],@ProgramFilesDir & "\Hummingbird\Connectivity\10.00\HostExplorer", "",)
               MsgBox(64, "Results", 'Running: ShellExecute("terminal.exe", ' & $avSwitches1[$n][1] & ', "%PROGRAMFILES%\HostExplorer\", "",)')
           EndIf
       Next
   EndFunc  ;==>_OK
   Func _section3()
       For $n = 1 To $avSwitches2[0][0]
           If ControlCommand($hGui, "", $avSwitches2[$n][0], "IsChecked") Then
              ;ShellExecute("HOSTEX32.EXE", " " & $avSwitches2[$n][1],@ProgramFilesDir & "\Hummingbird\Connectivity\10.00\HostExplorer", "",)
               MsgBox(64, "Results", 'Running: ShellExecute("terminal.exe", ' & $avSwitches2[$n][1] & ', "%PROGRAMFILES%\HostExplorer\", "",)')
           EndIf
       Next
   EndFunc  ;==>_OK
   Func _section4()
       For $n = 1 To $avSwitches3[0][0]
           If ControlCommand($hGui, "", $avSwitches3[$n][0], "IsChecked") Then
              ;ShellExecute("HOSTEX32.EXE", " " & $avSwitches4[$n][1],@ProgramFilesDir & "\Hummingbird\Connectivity\10.00\HostExplorer", "",)
               MsgBox(64, "Results", 'Running: ShellExecute("terminal.exe", ' & $avSwitches3[$n][1] & ', "%PROGRAMFILES%\HostExplorer\", "",)')
           EndIf
       Next
   EndFunc  ;==>_OK
   Func _section5()
       For $n = 1 To $avSwitches4[0][0]
           If ControlCommand($hGui, "", $avSwitches4[$n][0], "IsChecked") Then
              ;ShellExecute("HOSTEX32.EXE", " " & $avSwitches4[$n][1],@ProgramFilesDir & "\Hummingbird\Connectivity\10.00\HostExplorer", "",)
               MsgBox(64, "Results", 'Running: ShellExecute("terminal.exe", ' & $avSwitches4[$n][1] & ', "%PROGRAMFILES%\HostExplorer\", "",)')
           EndIf
       Next
   EndFunc  ;==>_OK
   Func _Quit()
       Exit
   EndFunc  ;==>_Quit
   Func _GUICtrlCreateCustomMenu($MenuFile, ByRef $ItemEventsArr)
       Local $MenuID, $MenuID2, $ItemID, $iCnt = 0
       $MainMenuSectArr = IniReadSection($MenuFile, "Main Menu")
       If Not @error Then
           For $iArr = 1 To $MainMenuSectArr[0][0]
               If StringLeft($MainMenuSectArr[$iArr][0], 8) = "Submenu," Then $MenuID = GUICtrlCreateMenu(StringTrimLeft($MainMenuSectArr[$iArr][0], 9))
               $SubMenuArr = IniReadSection($MenuFile, StringTrimLeft($MainMenuSectArr[$iArr][0], 9))
               If Not @error Then
                   For $jArr = 1 To $SubMenuArr[0][0]
                       $iCnt += 1
                       ReDim $ItemEventsArr[$iCnt + 1][2]
                       If StringLeft($SubMenuArr[$jArr][0], 5) = "Item," Then
                           $ItemID = GUICtrlCreateMenuitem(StringTrimLeft($SubMenuArr[$jArr][0], 6), $MenuID)
                           $ItemEventsArr[$iCnt][0] = $ItemID
                           $ItemEventsArr[$iCnt][1] = $SubMenuArr[$jArr][1]
                       ElseIf StringLeft($SubMenuArr[$jArr][0], 8) = "Submenu," Then
                           $MenuID2 = GUICtrlCreateMenu(StringTrimLeft($SubMenuArr[$jArr][0], 9), $MenuID)
                           $SubSubMenuArr = IniReadSection($MenuFile, StringTrimLeft($SubMenuArr[$jArr][0], 9))
                           If Not @error Then
                               For $ijArr = 1 To $SubSubMenuArr[0][0]
                                   $iCnt += 1
                                   ReDim $ItemEventsArr[$iCnt + 1][2]
                                   If StringLeft($SubSubMenuArr[$ijArr][0], 5) = "Item," Then $ItemID = GUICtrlCreateMenuitem(StringTrimLeft($SubSubMenuArr[$ijArr][0], 6), $MenuID2)
                                   GUICtrlSetOnEvent($ItemID, "MainEvents")
                                   $ItemEventsArr[$iCnt][0] = $ItemID
                                   $ItemEventsArr[$iCnt][1] = $SubSubMenuArr[$ijArr][1]
                                   $ItemEventsArr[0][0] = $iCnt
                               Next
                           EndIf
                       EndIf
                       GUICtrlSetOnEvent($ItemID, "MainEvents")
                       $ItemEventsArr[0][0] = $iCnt
                   Next
               EndIf
           Next
       EndIf
   EndFunc
   
   Func MainEvents()
       For $iEv = 1 To $ItemEventsArr[0][0]
           If @GUI_CtrlId = $ItemEventsArr[$iEv][0] Then
               $CurentIDVal = $ItemEventsArr[$iEv][1]
               Select
                   Case StringLeft($CurentIDVal, 8) = "Execute,"
                       Run(StringStripWS(StringTrimLeft($CurentIDVal, 8), 3))
                       If @error Then MsgBox(16, "Error - Program not found", "Can not execute an external program")
                   Case $CurentIDVal = "Exit"
                       Exit
                   Case StringLeft($CurentIDVal, 7) = "MsgBox,"
                       Local $Title, $Message
                       $TitleMsgArr = StringSplit($CurentIDVal, ",")
                       If IsArray($TitleMsgArr) Then
                           If $TitleMsgArr[0] >= 3 Then $Title = $TitleMsgArr[3]
                           If $TitleMsgArr[0] >= 5 Then $Message = $TitleMsgArr[5]
                           MsgBox(64, $Title, $Message)
                       EndIf
               EndSelect   
               ExitLoop
           EndIf
       Next
   EndFunc

Two ini files are used here

IP.ini is setup like this:

[section1]

AKAAOOL1=166.165.170.001

AKAAOOL2=166.165.170.002

AKAAOOL3=166.165.170.003

AKAAOOL4=166.165.170.004

AKAAOOL5=166.165.170.005

AKAAOOL6=166.165.170.006

AKAAOOL7=166.165.170.009

[section2]

BBBBBB1=168.219.15.001

BBBBBB2=168.219.15.002

BBBBBB3=168.219.15.003

BBBBBB4=168.219.15.004

BBBBBB5=168.219.15.005

BBBBBB6=168.219.15.006

BBBBBB7=168.219.15.007

[section3]

CCCCCC1=192.47.48.001

CCCCCC2=192.47.48.002

CCCCCC3=192.47.48.003

CCCCCC4=192.47.48.004

CCCCCC5=192.47.48.005

[section4]

DDDDDD1=212.116.132.001

DDDDDD2=212.116.132.002

DDDDDD3=212.116.132.003

DDDDDD4=212.116.132.004

DDDDDD5=212.116.132.005

[section5]

EEEEEE1=166.47.180.001

EEEEEE2=166.47.180.002

EEEEEE3=166.47.180.003

EEEEEE4=166.47.180.004

EEEEEE5=166.47.180.005

EEEEEE6=166.47.180.006

EEEEEE7=166.47.180.007

and Menu.ini reads like this:

[Main Menu]

Submenu, File=

Submenu, Web Links=

[File]

Item, Exit=Exit

[Web Links]

Item, Link1 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Item, Link2 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Item, Link3 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Item, Link4 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Item, Link5 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Item, Google = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.google.com

Item, Link7 = Execute, "C:\Program Files\Internet Explorer\iexplore.exe" http://www.somewhere.com

Please let me know what ya think?

Share this post


Link to post
Share on other sites



WOW... 35 views and nothing. True, most of the views were porbably me tho.. LOL I Guess no one works with Hummingbird and telnet sessions.. LOL

Share this post


Link to post
Share on other sites

I use Hummingbird but I don't have the time to read the whole thing. What does it do?

Ralph

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Basically it handles all of your telnet sessions and sets up all your sessions for you to launch at your convenience and allows the ips to be controlled by wherever you decide inside an ini. Uses page up and page down to get rid of it out of your way or bring it up to call on a telnet session. also has a dynamic menu at top. There is allot to play with. you will of course need to customize it for your needs.

Edited by gesller

Share this post


Link to post
Share on other sites

I have an updated version for use with 3.2.10.0 if anyone needs it. rather large for the forum, but if anyone needs it just pm me or post here...

Share this post


Link to post
Share on other sites

Well I would use it just don't use Hummingbird nor do I use telnet :D Nice of you to share though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0