Can't communicate with WinSCP Shell from script

Advertisement

goandersen
Joined:
Posts:
2
Location:
Omaha

Can't communicate with WinSCP Shell from script

I have encountered a new problem since installing Beta version 5.0.2 and 5.0.3.
I need to use passive mode and explicit ssl with a California government agency. I was able to do that with our previous version of WinSCP using a stored session, but I don't believe it was supported in a script until 5.0.2.
Now that we have installed 5.0.2 (and subsequently, 5.0.3), I can open the Winscp window with the following code:
WshShell = CREATEOBJECT("WScript.Shell")

WshShell.CurrentDirectory = this.icTempDirectory

ON ERROR llSuccess = .F.

oExec = WshShell.EXEC('"' + this.icWinSCPPath + '" /log=putlog.xml')

When I try to send my script to Winscp, I get no response.

I use the following to send the script:
oExec.StdIn.WriteLine('option batch abort')
oExec.StdIn.WriteLine('option confirm off')
IF (.inReconnectTime > 0)
oExec.StdIn.WriteLine('option reconnecttime ' + ALLTRIM(STR(this.inReconnectTime)))
ENDIF
oExec.StdIn.WriteLine('open ftps://' + .icUsername + ':' + .icPassword + '@' + .icServer + lcPort + '-explicitssl -passive=on -timeout=600')
oExec.StdIn.WriteLine('get /users/apprisk/ak1/*.txt ' + lcTempDirectory)
oExec.StdIn.WriteLine('close ')
oExec.StdIn.WriteLine('exit ')


The WinSCP window doesn't close, and the application stops.
When I manually close the window and execute the following:

lcOutput = oExec.StdOut.ReadAll()

All that is returned is the "winscp>" prompt.

What has changed that is causing my problem? I have tried to use the stored sessions that were working previously, but they no longer work either.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,096
Location:
Prague, Czechia

Re: Can't communicate with WinSCP Shell from script

Thanks for your post. I'll check and contact you soon.
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,096
Location:
Prague, Czechia

Re: Can't communicate with WinSCP Shell from script

I have sent you an email.

Reply with quote

NonaSuomy
Guest

I get the same results using vbs, what was the fix?

Any chance you can add a VBS example along side the JScript one

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,096
Location:
Prague, Czechia

NonaSuomy wrote:

I get the same results using vbs, what was the fix?
I haven't got an answer so far.

Can you send me an email, so I can send you back a debug version of WinSCP to track the problem? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.

_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum