deployk Posted September 16, 2010 Posted September 16, 2010 Hello. This script does not work. Where wrong. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("SSH", 331, 238, 326, 220) $Group1 = GUICtrlCreateGroup(" SSH Login", 8, 8, 313, 217) $IP = GUICtrlCreateLabel("IP", 80, 48, 21, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 104, 48, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "212.233.209.73") $User = GUICtrlCreateLabel("User", 64, 96, 39, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Username = GUICtrlCreateInput("", 104, 96, 129, 21) $Password = GUICtrlCreateLabel("Password", 24, 136, 77, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Pass = GUICtrlCreateInput("", 104, 136, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) $Login = GUICtrlCreateButton("Login", 104, 176, 107, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Cancel = GUICtrlCreateButton("Cancel", 232, 176, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Label1 = GUICtrlCreateLabel("Port", 240, 48, 36, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Input3 = GUICtrlCreateInput("22", 280, 48, 25, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Cancel Exit case $Login $IPAddress1 = GUICtrlRead($IPAddress1) $Username = GUICtrlRead($Username) $Pass = GUICtrlRead($Pass) ExitLoop EndSwitch WEnd Run(@ComSpec & " /c putty.exe -ssh -2 -P 22" & $Username & "@" & $IPAddress1 & "-pw" & $Pass & "", @SW_HIDE)
wakillon Posted September 16, 2010 Posted September 16, 2010 (edited) are you sure there is no space needed in your comspec line ? parameters : putty.exe -ssh -2 -P 22 admin@ip -pw pass -m commande.txt Edited September 16, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
deployk Posted September 16, 2010 Author Posted September 16, 2010 I found this script and try to change it a little.
Varian Posted September 16, 2010 Posted September 16, 2010 Needed space between 22 and $UsernameNeeded space before and after -pwChanged "$IPAddress1 = GUICtrlRead($IPAddress1)" to "$IPAddress1 = _GUICtrlIpAddress_Get($IPAddress1)"...$IPAddress1 was returning 0 with GUICtrlReadIf you used @Comspec with @SW_HIDE, both CMD window and Putty were hiddenFixed Scriptexpandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("SSH", 331, 238, 326, 220) $Group1 = GUICtrlCreateGroup(" SSH Login", 8, 8, 313, 217) $IP = GUICtrlCreateLabel("IP", 80, 48, 21, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 104, 48, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "212.233.209.73") $User = GUICtrlCreateLabel("User", 64, 96, 39, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Username = GUICtrlCreateInput("", 104, 96, 129, 21) $Password = GUICtrlCreateLabel("Password", 24, 136, 77, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Pass = GUICtrlCreateInput("", 104, 136, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $Login = GUICtrlCreateButton("Login", 104, 176, 107, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Cancel = GUICtrlCreateButton("Cancel", 232, 176, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Label1 = GUICtrlCreateLabel("Port", 240, 48, 36, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Input3 = GUICtrlCreateInput("22", 280, 48, 25, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit Case $Login $IPAddress1 = _GUICtrlIpAddress_Get($IPAddress1) $Username = GUICtrlRead($Username) $Pass = GUICtrlRead($Pass) ExitLoop EndSwitch WEnd $Command = "putty.exe -ssh -2 -P 22 " & $Username & "@" & $IPAddress1 & " -pw " & $Pass MsgBox(32, 'Command to Pass', $Command & @LF & $IPAddress1) ;comment out this line for production Run($Command)
deployk Posted September 16, 2010 Author Posted September 16, 2010 (edited) Thanks Varian , this worksexpandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("SSH", 331, 238, 326, 220) $Group1 = GUICtrlCreateGroup(" SSH Login", 8, 8, 313, 217) $IP = GUICtrlCreateLabel("IP", 80, 48, 21, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 104, 48, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "212.233.209.73") $User = GUICtrlCreateLabel("User", 64, 96, 39, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Username = GUICtrlCreateInput("", 104, 96, 129, 21) $Password = GUICtrlCreateLabel("Password", 24, 136, 77, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Pass = GUICtrlCreateInput("", 104, 136, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $Login = GUICtrlCreateButton("Login", 104, 176, 107, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Cancel = GUICtrlCreateButton("Cancel", 232, 176, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Label1 = GUICtrlCreateLabel("Port", 240, 48, 36, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Input3 = GUICtrlCreateInput("22", 280, 48, 25, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit Case $Login $IPAddress1 = _GUICtrlIpAddress_Get($IPAddress1) $Username = GUICtrlRead($Username) $Pass = GUICtrlRead($Pass) ExitLoop EndSwitch WEnd GUISetState(@SW_HIDE) RunWait(@ComSpec & " /c putty.exe -ssh -2 -P 22 " & $Username & "@" & $IPAddress1 & " -pw " & $Pass, "", @SW_HIDE) Edited September 16, 2010 by deployk
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now