View Single Post
  #8  
Old 01-07-2018, 02:38 PM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Thumbs up

Ok, got the file generation portion completed and was able to test the download function. I had to make a few tweaks but it appears to be working good.

Code:
Function f9SFTP(FileName,Destination,getput)
	Set objSFTPTab = crt.GetScriptTab.ConnectSFTP
	strScreenText = objSFTPTab.Screen.WaitforString("sftp>",5)
	If strScreenText = 0 Then
		f9SFTP = "TimeOut"
		objSFTPTab.Close
		Exit Function
	End If
	If getput = "get" Then
		objSFTPTab.Screen.Send "ls " & FileName & vbcr
		strFileListing = objSFTPTab.Screen.ReadString("sftp>")
		If InStr(strFileListing,"cannot") Then 
			f9SFTP = "NoFile"
			objSFTPTab.Close
			Exit Function
		End If
	End If
	objSFTPTab.Screen.Send "lcd " & Destination & vbcr
	objSFTPTab.Screen.WaitForString "sftp>"
	objSFTPTab.Screen.Send getput & " " & FileName & vbcr
	strResults = objSFTPTab.Screen.ReadString("sftp>")
	If Instr(strResults,"100%") > 0 Then
		f9SFTP = "Success"
		objSFTPTab.Screen.Send "rm " & FileName & vbCr
		objSFTPTab.Screen.WaitForString "sftp>"
	Else
		f9SFTP = "Fail"
	End If
	objSFTPTab.Close
End Function
__________________
Version 6.7.3 (build 292)

Last edited by bstedh; 01-07-2018 at 05:22 PM.
Reply With Quote