VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   General (https://forums.vandyke.com/forumdisplay.php?f=11)
-   -   Help on using command line to create a session and run scripts in the session (https://forums.vandyke.com/showthread.php?t=12454)

kingboli 08-24-2016 02:45 AM

Help on using command line to create a session and run scripts in the session
 
I want to use command-line to auto create a session and then auto run a script in this session. But there is an error about parameter "/SCRIPT" when I use below command in a bat file:

"C:\Users\AppData\Local\VanDyke Software\SecureCRT\SecureCRT.EXE" /SERIAL COM5 /BAUD 115200 /SCRIPT test.py

What should I do to auto create a session and then auto run a script? I do not want any manual settings and operations.

My SecureCRT version is 7.3 and the beginning lines of my script are:

def main():

crt.Screen.Synchronous = True
crt.Screen.WaitForString("=>")
crt.Screen.Send("ls")
....

Thanks

bgagnon 08-24-2016 08:40 AM

Hi kingboli,

You have your command-line options out of order.

The standard option /SCRIPT should come before the *protocol-specific* options.

See this recent post.

kingboli 08-24-2016 11:02 PM

How to quit?
 
Hi bgagnon,
Thanks for your help and it works.

There are another three questions, can you help answer them ?
1. I use crt.quit at the end of the main function to close the application, but it is not worked. And it seems crt.quit does not take effect.

2. I want to save logs printed on the SecureCRT's screen, what should I do?

3. I want to append the previous log file with new outputs during the next time's running SecureCRT, that's to say, if I launched 10 time's SecureCRT, I wanted to record the 10 screen outputs to one log file in append mode.

Great thanks for your help.

bgagnon 08-25-2016 10:11 AM

Hi kingboli,

You are welcome. :)

As to the new inquiries, I see you created another thread with similar questions. We will answer them there since you titled this one "using command line".


All times are GMT -6. The time now is 07:53 AM.