View Single Post
  #3  
Old 12-08-2017, 04:20 PM
mschaafs mschaafs is offline
Registered User
 
Join Date: Oct 2017
Posts: 27
Talking It's alive!

Yes! Thank you Brenda... Using a new login connection worked... but now I have to deal with the password, but I will get that figured out.
I am using version 8.1.4 build 1443. One weird thing I am seeing, is that I have to send a command that appears not to be working in order to send one that does work. See below, I have the 'lpwd' command being sent twice, because the first one doesn't show up. Also, is there a command to force a disconnect without a prompt?

Code:
// SFTP test
var objTab;
var objSFTPTab;
objTab = crt.Session.ConnectInTab("/SSH2 /L user /PASSWORD pw host");
objTab.Caption = "Connection Tab";
objTab.Screen.Synchronous = true;

// Create an SFTP tab associated with the existing tab
objSFTPTab = objTab.ConnectSFTP();
objSFTPTab.Caption = "SFTP Tab";
objSFTPTab.Screen.Synchronous = true;
crt.Sleep(1000);

// Wait for the SFTP tab to be ready for input.
objSFTPTab.Screen.Send(String.fromCharCode(13));
objSFTPTab.Screen.WaitForString("sftp>");

// Send extra command to prompt to activate, for whatever reason... is required.
objSFTPTab.Screen.Send("lpwd" + String.fromCharCode(13));
objSFTPTab.Screen.WaitForString("sftp>");

objSFTPTab.Screen.Send("lpwd" + String.fromCharCode(13));
objSFTPTab.Screen.WaitForString("sftp>");

objSFTPTab.Screen.Send("lcd newLocalPath" + String.fromCharCode(13));
objSFTPTab.Screen.WaitForString("sftp>");

objSFTPTab.Screen.Send("get fileNameHere" + String.fromCharCode(13));
objSFTPTab.Screen.WaitForString("sftp>");

// Close the SFTP tab
objSFTPTab.Close();
// Close the connection on the originating SSH2 connection's tab
objTab.Session.Disconnect();
objTab.Close();
Reply With Quote