xshell script api
Xshell支持使用VB,JS,Python脚本去启动自动化任务。这里介绍一下xshell提供的API,并且提供一个python包xsh提高开发效率。
xsh.Seesion
The following functions and variables can be used in Xshell sessions. To use these functions and variables, execute them together with xsh.Session. For example, to use ‘Sleep()’ function, use ‘xsh.Session.Sleep(1000)’.
Return Value | Function | Parameter | Description |
---|---|---|---|
Void | Open(LPCTSTR lpszSession) | lpszSession A character string of an Xshell session path or URL format of Xshell. | Open a new session or URL. To open a session, place /s option in front of a character string. Ex.) To open the A.xsh session, use ‘/s $PATH/A.xsh’. |
Void | Close() | Close the currently connected session. | |
Void | Sleep(long timeout) | Timeout Milisecond unit time value. | Make Xshell wait for the designated time. |
Void | LogFilePath(LPCTSTR lpszNewFilePath) | lpszNewFilePath File name including path | Designate log file. |
void | StartLog() | Start logging for a session. Log is designated |