Run Commandline Script
I'm new here,
so hello to everybody.
I want to run a vbscript,
which runs securecrt,
which auto connects to the default server,
and then, when connected sends a command to the server:
"if /etc/init.d/dovecot status > /dev/null; then exit; fi"
If the dovecot server is running well,
securecrt gets an exit command and closes automaticly,
if dovecot server is not active,
securecrt stays active.
so if i ask the securecrt state in my starter vbscript,
i know, if dovecot server is running or not.
the goal is to run this in background without seeing the securecrt screen.
this is the logic.
my starter script begins:
strFile = C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe" strCommand = strFile & " /SCRIPT " & "I:\IsDovecotServerUp.vbs" objWshShell.Run strCommand, 0, True
#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True ' This automatically generated script may need to be ' edited in order to work correctly. Sub Main crt.Screen.Send "if /etc/init.d/dovecot status > /dev/null; then exit; fi" crt.Screen.Send chr(13) End Sub
CRT Scripting Runtime error
Error: Screen.Send not connected ... etc.
Normally when i start securecrt manually it automaticly connects the default server.
but not in this case.
this is my problem.
sorry 'bout my english,
which is not my mother language.
hope somebody can help me,
thanks in advance.
Last edited by jdev; 05-29-2018 at 12:36 PM. Reason: wrap code in [code] blocks
When you launch SecureCRT with the /Script command line argument, auto sessions do not get connected.
But, you can simply add an instruction to your command line to have SecureCRT connect to the session you desire. For instance, if your auto session's name is "My Auto Session Name", then your script can launch SecureCRT like this:
strFile = C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe" strCommand = strFile & " /SCRIPT " & "I:\IsDovecotServerUp.vbs" strCommand = strCommand & " /S " & chr(34) & "My Auto Session Name" & chr(34) objWshShell.Run strCommand, 0, True
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Display Modes||Rate This Thread|