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

martin

Re: Custom Command options "Show Results as message" and "Ig

Thanks for sharing your solution!
LordRegent

Re: Custom Command options "Show Results as message" and "Ig

Here's a kludge to check PHP Syntax and see the results in a message box:

php -l "!" 1>&2 && `exit -1`

If you then want to do something at the command prompt, click Skip otherwise click Abort.
LordRegent

Re: Custom Command options "Show Results as message" and "Ig

If I can find a command that will always throw a Return Code 255, I can put that at the end of the command chain with output pipe manipulation and thus force WinSCP to show me the command's output in a message box, to which I will respond "Abort" (unless I need to do something at the command line afterwards, in which case I will respond "Skip"). This is an inelegant and kludgy solution, but way better than a custom build.

I wonder if backticks around exit -1 would work?!
Guest

Re: Custom Command options "Show Results as message" and "Ignore

Differences between closing a Console window and message box:

    = non-responsive UI briefly while the Console window is instantiated
    = memory overhead for an otherwise unused Console window
    = mental focus shift due to the sudden appearance of a large dark rectangle
    = lack of fluidity for mouse; MsgBox is relatively nearby, not so the Close button

There is already code to make the response text "safe" to be put in a message prompt, because that is done with error output. There's already a custom message box handler which is used throughout the application. I just want to put the two together.
martin

Re: Custom Command options "Show Results as message" and "Ignore

What's a difference between closing a Console window and message box?

Thanks for the hint with || true, I have documented it here:
https://winscp.net/eng/docs/custom_commands#errors
LordRegent

Custom Command options "Show Results as message" and "Ignore

For Custom Commands, an option to "Show Results as message" would be useful on pass/fail commands with simple but significant output; for the message box, set the Title to the Custom Command's Description, the Prompt (or Content) to the command's output, and show an "OK" button. I can envision commands that need something done in the Terminal if they fail, so also having a button to dismiss the message then open the Terminal window could be useful.

Rationale: For many simply commands I neither need nor want the overhead and delay of opening the full Terminal window, which is only going to be immediately closed.
One such command is my "Check PHP Syntax":
php -l "!" || true


It would also be good to include in https://winscp.net/eng/docs/ui_customcommand a tip that appending
|| true
to a remote command will suppress any non-zero Return Code from the command, which allows the output to be shown in the terminal without going through the "Error executing custom command ... Abort / Retry / Skip / Skip all / Help" dialog. This tip works on Custom Commands in existing versions of WinSCP, but perhaps a future release can give Custom Commands an option "Ignore Return Code" which would simply bypass this dialog.