AutoIt Putty Commander

#include "GUIConstants.au3"
#include <WindowsConstants.au3>
#include <GuiListBox.au3>

;~ Global Const $WM_COMMAND = 0x0111
;~ Global Const $LBN_SELCHANGE = 1
;~ Global Const $LBN_DBLCLK = 2
$CONFIG_FILE = @ScriptDir & "\Putty Commander.cfg"

GUICreate("Putty Commander", 300, 500, -1, -1, 0x00040000)
$cmdList = GUICtrlCreateList("" , 10, 10, 280, 440, BitOR($WS_BORDER, $WS_VSCROLL, $GUI_FOCUS))
GUICtrlSetTip($cmdList, "Double click command to send to Putty" & @CRLF & "Double click the bottom info to edit command list")
If FileExists($CONFIG_FILE) Then
   $cmdFile = FileRead($CONFIG_FILE)
   $cmdArray = StringSplit($cmdFile, @CRLF, 1)
   For $i = 1 To UBound($cmdArray) - 1
	  _GUICtrlListBox_AddString($cmdList, $cmdArray[$i])
   Next
EndIf
$info = GUICtrlCreateLabel("* Copyright (C) SEG, 2016", 10, 450, 280, -1)
$cmdEdit = GUICtrlCreateEdit("", 10, 10, 280, 440)
GUICtrlSetState($cmdEdit, $GUI_HIDE)

GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GuiSetState()
While 1
   $msg = GUIGetMsg()
   Select
	  Case $msg = $GUI_EVENT_CLOSE
		 ExitLoop 

	  Case $msg = $cmdList
		 $Selected = GUICtrlRead($cmdList)
		 GUICtrlSetData($info, "* Double click me to edit commands")
   EndSelect
Wend

Exit

Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
   $nNotifyCode = BitShift($wParam, 16)
   $nID = BitAnd($wParam, 0x0000FFFF)
   $hCtrl = $lParam

   If $nID = $cmdList And ($nNotifyCode = $LBN_DBLCLK  Or $nNotifyCode = 0x00) Then
	  $Selected = GUICtrlRead($cmdList)
	  ConsoleWrite($Selected)
	  ControlSend("[CLASS:PuTTY]", "", "", $Selected & "{ENTER}")
	  Return 0
   EndIf

   If $nID = $info And $nNotifyCode = 0x01 Then
	  If GUICtrlRead($info) = "* Double click me to save" Then
		 ; save to config file
		 $cmdNew = GUICtrlRead($cmdEdit)
		 FileDelete($CONFIG_FILE)
		 FileWrite($CONFIG_FILE, $cmdNew)
		 ; update list box
		 GUICtrlSetData($cmdList, "")
		 $cmdArray = StringSplit($cmdNew, @CRLF, 1)
		 For $i = 1 To UBound($cmdArray) - 1
			_GUICtrlListBox_AddString($cmdList, $cmdArray[$i])
		 Next
		 ; update states of all controls
		 GUICtrlSetState($cmdEdit, $GUI_HIDE)
		 GUICtrlSetState($cmdList, $GUI_SHOW)
		 GUICtrlSetData($info, "* Double click me to edit commands")
	  Else
		 $cmdFile = FileRead($CONFIG_FILE)
		 GuiCtrlSetData($cmdEdit, $cmdFile)
		 GUICtrlSetState($cmdList, $GUI_HIDE)
		 GUICtrlSetState($cmdEdit, $GUI_SHOW)
		 GUICtrlSetData($info, "* Double click me to save")
	  EndIf

	  Return 0
   EndIf
EndFunc
时间: 2024-12-17 19:38:49

AutoIt Putty Commander的相关文章

Putty 远程连接工具使用以及密钥验证

常用的远程ssh连接工具 PuTTY  xshell secureCRT 示例中使用putty 官网下载 putty.org 文件太多不能滚屏 ls /etc |less    #|管道符传送 less命令可以翻页 Putty 下载请先翻墙到官网下载. 利用Putty远程控制和操作 Linux. 1)putty生成的公钥和私钥 (2)把私钥保存到我们电脑上 (3)复制公钥粘贴到Linux的/root/.ssh/authorized_keys文件里, (4)默认/root/.ssh 这个目录是不存

ADB enhanced Putty (replacement for "adb shell" co

We all know that running "adb shell" from the command line is pretty crap, and when using a latter busybox version which has coloring support it's ultimately crap. One workaround was usually to start a telnet server on the phone, and use putty t

使用PuTTY配置秘钥登陆Linux

打开PuTTYgen,点击Generate生成秘钥.保存私钥. 创建authorized_keys文件$ sudo mkdir ~/.ssh$ sudo vim ~/.ssh/authorized_keys          #粘贴公钥$ sudo chmod 700 ~/.ssh$ sudo chmod 600 ~/.ssh/authoryied_keys 用PuTTY登陆时选择保存好的私钥.

macOS安装putty

本来是OS X,因为有了watchOS.iOS的命令方式(前面小写后面OS大写,一体化命令规则),估计未来OS X会更名为macOS. macOS上的免费ssh客户端软件并不多,我已知的有:vSSH Lite.Telnet Lite.Putty. 其中: vSSH Lite最烦人,老弹小窗提示你购买全功能版. Telnet Lite最好看.功能也够用. Putty 最难装,耗费了我好几个小时才装上. 综上:我个人选择Telnet Lite.原因:Telnet Lite好装.好看.好用.肯定要抛弃

python+selenium+autoit实现文件上传

问题 在做web端ui层自动化的时候会碰到文件上传的操作,经常有朋友问到,这里总结一下 解决方案 第一种:type=file的上传文件,类似如下的 使用类似这样的代码就可以完成: driver.find_element('name','file').send_keys('./小强测试品牌.png') 第二种:就是第一种除外的,实现起来较为麻烦,这里用到了autoit,大致步骤如下: 1.下载并安装autoit,之后在开始菜单可以看到如下 AutoIt Windows Info 用于识别Windo

WinSCP与Putty远程连接linux

1.  有时putty连接不上,可能是linux机器上的telnet服务未开,把蓝线上的√去掉. 2. ctrl + p 打开putty窗口: 3. putty如果显示乱码,右键 putty窗口,选择[修改设置],在 窗口→转换 设置项中设置 字符集:

Windows上基于快捷方式的Putty免密码登陆

创建putty.exe快捷方式,右击putty快捷方式,属性,目标,加上账户密码端口等参数,保存,关闭: putty.exe [-ssh | -telnet | -rlogin | -raw] [[email protected]]hostExample: putty -ssh -l vagrant -pw vagrant -P 2222 127.0.0.1 -V        print version information and exit -pgpfp    print PGP key

客户端putty, xshell连接linux中vim的小键盘问题

在putty上用vi的时候,开NumLock时按小键盘上的数字键并不能输入数字,而是出现一个字母然后换行(实际上是命令模式上对应上下左右的键).解决方法 选项Terminal->Features里,找到Disable application keypad mode,选上就可以了 在xmanager 4 中的xshell也有小键盘问题 解决方法为 修改session 属性 -> 终端->VT模式->初始数字键盘模式 选择 设置为普通.

selenium借助AutoIt识别上传(下载)详解

转自:http://www.cnblogs.com/fnng/p/4188162.html AutoIt目前最新是v3版本,这是一个使用类似BASIC脚本语言的免费软件,它设计用于Windows GUI(图形用户界面)中进行自动化操作.它利用模拟键盘按键,鼠标移动和窗口/控件的组合来实现自动化任务. 官方网站:https://www.autoitscript.com/site/ 从网站上下载AutoIt并安装,安装完成在菜单中会看到图4.13的目录: 图4.13  AutoIt菜单 AutoIt