1.背景
在使用SecureCRT时,默认鼠标左键选中,即可添加到剪切板,粘贴使用。但是在选中多行时候,粘贴出来是有换行符的,比如JSON格式的字符串,想要格式化就会因为换行符经常出现错误。因此在CRT增加一个脚本,将复制出来的多行字符去除换行符。
2步骤
2.1编写python脚本文件
新建python文件,例如removing line breaks.py
# $language = "Python"
# $interface = "1.0"
# get the selection
strText = crt.Screen.Selection
# put modified version into the clipboard:
crt.Clipboard.Text = strText.replace("\r\n", "")
2.2将脚本添加到快捷方式
view -> button bar
, 在button bar
右键设置button,可以定义不同的button,可以设置每个button执行一个特定的脚本,以后每次点击button即可执行
- 使用的时候,选中多行字符串,然后执行这个脚本(点击自定义的button即可)