View Single Post
  #4  
Old 05-01-2013, 02:19 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Thanks. There are multiple problems:
  • SecureCRT does not currently support /SCRIPT on a per session basis.
  • Using crt.screen.Send sends to the active tab, so it's not tab safe.
  • Using crt.Screen.Send and crt.screen.Send back to back, without WaitForString in between, inevitably leads to problems.
An immediately available alternative would be to split up the wsh call to start SecureCRT sessions without /T.
WshShell.run "C:\CRT\SecureCRT.exe /s Payroll /SCRIPT C:\brickman\crt_scripts\PayrollScripts\Branch671.vbs

WshShell.run "C:\CRT\SecureCRT.exe /s Payroll /SCRIPT C:\brickman\crt_scripts\PayrollScripts\Branch673.vbs

WshShell.run "C:\CRT\SecureCRT.exe /s Payroll /SCRIPT C:\brickman\crt_scripts\PayrollScripts\Branch674.vbs
Since /SCRIPT cannot be called multiple times, you need to find another way to activate the script.

A simple way might be:
  • Make a single, tab safe script named BranchScript.vbs
  • Have BranchScript.vbs read an argument that's sent to it, and based on that argument, send a specific line. Now you don't need to maintain so many scripts - you just need one script.
  • Instead of starting SecureCRT with a specific script, like this:
    WshShell.run "SecureCRT.exe /s Payroll /SCRIPT Branch674.vbs

    do something more general and pass in an argument, like this (pseudocode):
    foreach nBranchNum in ("674, 681, 781, 791, etc...")
    WshShell.run "SecureCRT.exe /SCRIPT "BranchScript.vbs" /ARG nBranchNum /T /S Payroll

Tab safety: you'll probably want to use GetScriptTab, which returns the tab or tiled session window from which the script was started.[/QUOTE] This function will be useful because each script will know which session started it. This will help you keep track of which tab to send to or read from.

I recognize that this is just an overview, and there isn't a quick solution. Fixing the back to back Sends, and making it script safe, the script will have little in common with what it is now when you're finished. It might be easier to start over with a script like: Read Data From Separate Hosts/Commands File And Log To Individual Files .
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote