Topic "Can't communicate with WinSCP Shell from script"

Author Message
goandersen
[View user's profile]

Joined: 2011-10-13
Posts: 2
Location: Omaha
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Thanks for your post. I'll check and contact you soon.
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I have sent you an email.
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License