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

Author Message
LordRegent

Guest


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":
Code:
php -l "!" || true


It would also be good to include in https://winscp.net/eng/docs/ui_customcommand a tip that appending
Code:
|| 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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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
_________________
Martin Prikryl
Guest




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.
LordRegent

Guest


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?!
LordRegent

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Thanks for sharing your solution!
_________________
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