posts - 54,comments - 23,trackbacks - 2
新建批处理--buildLinux.cmd
---------------------------------------------------------------------
del E:\dailybuilder\ftpTemp\linux
SecureCRT.EXE 
/"192.168.0.2" /script "E:\dailybuilder\WebSite\Tools\Linux.vbs"
copy 
/Y E:\dailybuilder\ftpTemp\linux E:\dailybuilder\WebSite\buildFolder\
REM Taskkill 
/IM SecureCRT.EXE /T
---------------------------------------------------------------------

新建VBScript文件--Linux.vbs
---------------------------------------------------------------------
#$language 
= "VBScript"
#$
interface = "1.0"

Sub main
  
' turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous 
= True
  If (Not crt.Screen.WaitForString(
"username"8)) Then
    crt.Screen.Send vbCr
    crt.Screen.WaitForString 
"username"
  End If
  
  crt.Screen.Send 
"cd /home/username/Coding" & VbCr
     crt.Screen.WaitForString 
"Coding"
  crt.Screen.Send 
"mk -c project.plf" & VbCr
     crt.Screen.WaitForString 
"Coding"
     crt.Screen.Send 
"cd /home/username/Coding/product/linuxd" & VbCr
     crt.Screen.WaitForString 
"linuxd"
     crt.Screen.Send 
"ftp 192.168.0.1" & VbCr
     crt.Screen.WaitForString 
"Name "
     crt.Screen.Send 
"ftpUser" & VbCr     
     crt.Screen.WaitForString 
"Password:"
     crt.Screen.Send 
"ftpPassword" & VbCr
     
'crt.Screen.WaitForString "ftp>"
     'crt.Screen.Send "delete jx_linux_t" & VbCr
     crt.Screen.WaitForString "ftp>"
     crt.Screen.Send 
"put linux" & VbCr
     crt.Screen.WaitForString 
"ftp>"
     crt.Screen.Send 
"quit" & VbCr
     crt.Screen.WaitForString 
"linuxd"
     crt.Screen.Send 
"exit" & VbCr
    crt.Sleep 
2000
  
' turn off synchronous mode to restore normal input processing
  crt.Screen.Synchronous = False
  crt.Sleep 
2000
  crt.Quit
End Sub
---------------------------------------------------------------------

附录(SecureCRT帮助):
Application Object Properties and Methods

Properties
 Methods
 
    ActivePrinter 
     GetTabCount
 
    Dialog
     GetTab
 
    Screen
     Sleep
 
    Session
     Quit
 
    Version
  
 
    Window
  
 

 

Properties

 

ActivePrinter

Description

Returns or sets the name of the active printer.

Syntax

crt.ActivePrinter [ = printerName ] 

Remarks

Read/Write string property.

Example:

If crt.ActivePrinter "\\SERVER\InkJet2" Then

crt.ActivePrinter = "\\SERVER\InkJet2"

MsgBox "Updated Printer"

End If

 

Dialog

Description

Returns a reference to SecureCRT's Dialog object.

Syntax

Set object = crt.Dialog

Remarks

See the Dialog object documentation for a description of its properties and methods.

 

Screen

Description

Returns a reference to SecureCRT's Screen object.

Syntax

Set object = crt.Screen

Remarks

Object variables assigned from the screen property require the "Set" syntax. See the Screen object documentation for a description of its properties and methods.

 

Session

Description

Returns a reference to SecureCRT's Session object.

Syntax

Set object = crt.Session

Remarks

See the Session object documentation for a description of its properties and methods.

 

Version

Description

Returns a string containing SecureCRT's version.

Syntax

crt.Version

Remarks

Read-only string property

 

Example:

MsgBox "The version of SecureCRT is: " & crt.Version

 

Window

Description

Returns a reference to SecureCRT's Window object.

Syntax

Set object = crt.Window

Remarks

See the Window object documentation for a description of its properties and methods.

 

 

Methods

GetTabCount

Description

Returns the number of tabs.

Syntax

object = crt.GetTabCount

Remarks

None.

 

GetTab

Description

Returns the tab object of the specified index.

Syntax

Set object = crt.GetTab arg

Remarks

This does not bring the tab to the foreground.

 

Sleep

Description

Specifies the time (in milliseconds) to pause the script's execution

Syntax

crt.Sleep millisec

Remarks

The amount of time that it takes to execute the Sleep() method itself is a factor in how long the script pauses. Therefore, the accuracy of invoking Sleep with small values of 1 or 10 milliseconds will be affected by this overhead.

 

Example:

' Send a CR and pause for one second

crt.Screen.Send vbCr

crt.Sleep 1000

 

Quit

Description

Causes SecureCRT to exit.

Syntax

crt.Quit

Remarks

A script that invokes Quit will be terminated immediately and cause SecureCRT to exit.

posted on 2007-03-14 11:44 凌度 阅读(1177) 评论(6)  编辑 收藏 网摘

FeedBack:
2007-03-14 11:57 | JesseZhao      
呵呵,不错哦
  回复  引用  查看    
2007-03-29 18:59 | 哭 [未注册用户]
有 SecureCRT 的 登陆脚本问题请教 能加 QQ317789829 么..

  回复  引用    
#3楼 [楼主]
2007-04-12 17:49 | 凌度      
To 哭:

请把你遇到的问题详细写出来,我看看能不能帮你解决
  回复  引用  查看    
2007-04-13 22:30 | ruru [未注册用户]
我要频繁登陆网络设备 路由器交换机什么的。
每次登录时候都要输入username password 什么的
能否写个脚本,当屏幕上一出现username或password
我一按Tab键就能自动输入用户和口令呢,如何实现呢
谢谢了。
  回复  引用    
2007-04-19 14:23 | linn [未注册用户]

新建VBScript文件--192_168_0_1.vbs
---------------------------------------------------------------------
#$language = "VBScript"
#$interface = "1.0"

Sub main
crt.Screen.WaitForString "linuxd"
crt.Screen.Send "ftp 192.168.0.1" & VbCr
crt.Screen.WaitForString "Name "
crt.Screen.Send "ftpUser" & VbCr
crt.Screen.WaitForString "Password:"
crt.Screen.Send "ftpPassword" & VbCr
End Sub

然后点击secureCRT菜单:脚本-》运行,选择本脚本文件即可不用输入密码。不过这样做的话密码是明文保存,呵呵。
  回复  引用    
2007-08-23 19:00 | KK [未注册用户]
能否写个脚本,只要我点击secureCRT菜单:脚本-》运行该脚本,就自动帮我执行若干条查询命令@linn
比如命令1:DSP PORT
  命令2:DSP BRD
  命令3:DSP CLK
  命令4:DSP DHSTA
  等等

  回复  引用    

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2007-03-14 11:47 编辑过
Google站内搜索
找找看



China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
近千种 9-95 新二手计算图书火热销售中!
开发者征途系统新作:《设计模式——基于C#的工程化实现及扩展》

相关文章:

相关链接: