Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

DaveLane

Re: Exitcode reporting and no-user-prompting when using /console /script=

martin wrote:


OK, I may return exit code 1 if any prompt during script execution was answered "abort" (even automatically because of 'option batch on'). But I suppose you would rather have the script stopped once such event occures, wouldn't you?


Actually that would be perfect for my purposes since I only upload one file (a zip file) per session. Thanks for including this new feature in V3.7.1 - much appreciated. I've tested it and it works perfectly.

My application is an astronomical observatory automation program which includes a feature to upload the night's images to a server at the end of the night.

Regards, Dave
martin

Re: Exitcode reporting and no-user-prompting when using /console /script=

DaveLane wrote:

My trouble with using 'set batch on' is that I have no way of knowing if my transfer was successful or not. I supposed I could try parsing the

As mentioned earlier, the ideal solution would be setting the exit code to 0 if no error occurred or 1 is any error occurred.

OK, I may return exit code 1 if any prompt during script execution was answered "abort" (even automatically because of 'option batch on'). But I suppose you would rather have the script stopped once such event occures, wouldn't you?
DaveLane

Re: Exitcode reporting and no-user-prompting when using /console /script=

martin wrote:

If you read the error message carefully, you would that your server does not reply. So there is some other problem. I do not know what. Do you have the problem even in GUI (graphical) mode? Can you post a log file?


The 'option batch on' command solved my problem of the user prompts. The example that I gave you intentionally had an error in it so that a user-prompt would be shown. When no error occurs winscp3 works flawless for me.

My trouble with using 'set batch on' is that I have no way of knowing if my transfer was successful or not. I supposed I could try parsing the

As mentioned earlier, the ideal solution would be setting the exit code to 0 if no error occurred or 1 is any error occurred.

Cheers,

Dave

ps. I was using winscp3.exe (although winscp3.com acts the same).
martin

Re: Exitcode reporting and no-user-prompting when using /console /script=

If you read the error message carefully, you would that your server does not reply. So there is some other problem. I do not know what. Do you have the problem even in GUI (graphical) mode? Can you post a log file?

Even when you process the script file, you can still reply the prompts. I do not know why WinSCP hangs in your case. Are you running the script using winscp3.exe or winscp3.com?

You can avoid prompts at all using "option batch on", but it will not probably help in your case.
DaveLane

Re: Exitcode reporting and no-user-prompting when using /console /script=

You asked: When does this happen?

Below is an example:

C:\Program Files\WinSCP3>winscp3 dlane@crux.stmarys.ca /console /script=test.txt

Initialisation...
Searching for host...
Connecting to host...
Authenticating...
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] dlane@crux.stmarys.ca
Host hasn't answered for 15 seconds.
Wait for another 15 seconds? Pressing 'Abort' button will close session.
(A)bort, (R)etry:

The script was:

cd /home/dlane/test
put file.txt
close
exit

In this case the script was cd'ing to a directory that did not exist. The user is prompted to abort or retry, but if a program is running the script it can't reply to it, it just hangs. The same occurs if other "errors" occur during the process.

You wrote: I'll consider that, but it may be difficult to fit into current concept of the scripting.

My concept of scripting is to allow the scp process to be automated by other programs (without human intervention) and in this scenario there would have to be some way to know if the operation succeeded or failed.

Cheers, Dave
martin

Re: Exitcode reporting and no-user-prompting when using /console /script=

DaveLane wrote:

- not wait for user input when an error occurs (just fail the operation)

When does this happen?
- report the error via an ExitCode that can be accessed by the calling program or batch file.

I'll consider that, but it may be difficult to fit into current concept of the scripting.
DaveLane

Exitcode reporting and no-user-prompting when using /console /script=

First of all, I'm delighted to see scripting support in WinSCP! Since I'm calling it from my own program, it would be very useful for it to (have an option to):

- not wait for user input when an error occurs (just fail the operation)
- report the error via an ExitCode that can be accessed by the calling program or batch file.

Thanks again for your efforts with WinSCP.

... Dave Lane
Nova Scotia Canada