Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-19-2018, 11:59 AM
Caster Caster is offline
Registered User
 
Join Date: Nov 2018
Posts: 1
Run Next Line in .txt file

I am trying to run a script for backups and in my text file is a list of hosts that backups need to occur on. The script runs just fine for the first host, but then stops and does not go to the next line in the .txt file. How do I remedy this?

Below is my script.

# $language = "JScript"
# $interface = "1.0"

// Open the file c:\temp\file.txt, read it line by line sending each
// line to the server. Note, to run this script successfully you may need
// to update your script engines to ensure that the filesystemobject runtime
// is available.

function main()
{
var fso, f, r;
var ForReading = 1, ForWriting = 2;

fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("c:\\Documents\\Backups\\Scripting_Backups.txt");

crt.Screen.Synchronous = true;

var str;
while ( true )
{

str = f.Readline();
str += "\015" ;
//crt.Dialog.Prompt(str);
crt.Screen.Send( str );
crt.Screen.WaitForString ( "?", 10 ) ;
crt.Screen.Send ( "yes\015" ) ;
//crt.Screen.Sendkeys ( "~" ) ;
crt.Screen.WaitForString ( "password:" ) ;
crt.Screen.Send ( "xxxxxxxx\015" ) ;
//crt.Screen.Sendkeys ( "~" ) ;
//crt.Screen.WaitForString ("prompt$") ;
}
};
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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