AskParam: Asks for command-line parameters via GUI dialog

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

AskParam: Asks for command-line parameters via GUI dialog

Post by *MVV »

This little tool allows entering command line parameters in GUI dialog. Entered parameters may be inserted into command line of process to be started in any order and ammount. You can set dialog title, prompt text and set of suggested strings for drop-down list. Environment variables in suggested strings are expanded automatically before asking corresponding parameter value.

Environment variables are expanded anywhere: in started application path, in suggested strings, in full parameter string passed to that application, and in dialog caption and hint text.

Start AskParam w/o parameters to read message with syntax description.


How to call AskParam from batch multiple times and gather all answers?



Last version information

Version: 1.0.6
URL: AskParam at wincmd.ru / AskParam at totalcmd.net

Requirements: operating system Windows 2000 and above, Total Commander :) (Total Commander is not necessary)
Last edited by MVV on 2019-12-12, 06:03 UTC, edited 5 times in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ehab wrote:MVV, can you please add a /H to the askparam parameters so it hides the text entered.

why? i use askparam to enter a password and with current state it has clear text.

thanks for any reply.
seb- wrote:This would be a nice enhancement, support.
OK, I'll add input mode for entering passwords.

Added after 11 minutes:

Done, please download updated version. :)
I've added parameters /h and /h-, first one enables password enter mode, second one disables it. Just change the mode before corresponding /p parameter, e.g.:

Code: Select all

AskParam.exe /cTest /tmYpAsS /h /p"Enter password:" /td /h- /p"Enter drive letter:"
User avatar
ehab
Senior Member
Senior Member
Posts: 271
Joined: 2007-10-29, 07:41 UTC
Location: Libya

Post by *ehab »

:D

i am happy.

thank you MVV i wish you a nice happy week.
#181344 Personal licence
seb-
Senior Member
Senior Member
Posts: 276
Joined: 2011-11-15, 06:14 UTC
Location: DE\BN - only part time TC user after switching to Linux ;)

Post by *seb- »

Works perfectly :-)

Thanks for this QUICK feature-request to implementation time ;-)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You're welcome, guys. Thanks for good idea. :)

It wasn't hard to implement, just process another parameter and send a message (EM_SETPASSWORDCHAR) to EDIT control.
User avatar
ehab
Senior Member
Senior Member
Posts: 271
Joined: 2007-10-29, 07:41 UTC
Location: Libya

Post by *ehab »

i have an addition :idea: :) to ask

i sometimes need to pass the password to a console application STDIN, exactly like ssh-askpass.

there is an old tool that does not work anymore called win-ssh-askpass found http://sourceforge.net/projects/winsshaskpass/

the important part is instead of passing the arguments and calling the exe it writes the input to STDIN

this was the code from the above project needed in AskParam :

Code: Select all

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
  DWORD count;
  AllocConsole();
  HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  WriteFile(hStdout, Pwd.c_str(), Pwd.Length(), &count, NULL);
  Application->Terminate();
}
MVV, can you please add this feature.

for example

Code: Select all

AskParam.exe /R /cTest /tmYpAsS /h /p"Enter password:"
the /R parameter would write to the STDOUT and when used only 1 Input is allowed, " askparam does not parse more than one /p

i hope i explained the idea and thanks for any consideration from your side.
#181344 Personal licence
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AskParam is a GUI tool and it doesn't work with console, it doesn't have it at all. You may try to mix it with ConPaste if you wish to enter a password into console.
User avatar
ehab
Senior Member
Senior Member
Posts: 271
Joined: 2007-10-29, 07:41 UTC
Location: Libya

Post by *ehab »

i am still trying it but seams it needs a command to execute which in my case i don't have.

can you please tell me what is wrong with this:

Code: Select all

ConPaste.exe /c"caption" /p"pass" "enterpassword" cls
i use the cls because i have no command? i just want ConPaste.exe return the entered password to the caller in my case something like:

Code: Select all

encfs.exe d:\enPath  t:\ -S ConPaste.exe /c"caption" /p"pass" "enterpassword" cls
the above does not work.

Anyway, thanks for mentioning this tool, will be useful one day.
#181344 Personal licence
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AFAIK there are TWO ways to pass a password to a console application:
1. Pass it in command line parameters. AskParam can already do it, especially with /h mode.
2. Write it directly to console when application is requesting for user input (when it writes something like 'Enter a password:'). In such case you may simply write password to console window or use ConPaste to ask it via GUI dialog.

I don't know other cases when you need to enter password.
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

MVV wrote:AFAIK there are TWO ways to pass a password to a console application:
1. Pass it in command line parameters. AskParam can already do it, especially with /h mode.
2. Write it directly to console when application is requesting for user input (when it writes something like 'Enter a password:'). In such case you may simply write password to console window or use ConPaste to ask it via GUI dialog.

I don't know other cases when you need to enter password.
You also have a 2b solution using redirection (if application accept it):

Code: Select all

echo %password%|myApplication ...
SendPassFromGUI|myApplication
myApplication ....<FilenameWithPassword.txt
I was using this a lot in the previous century;)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Redirection just matches case 2: when an application requests for user input, Windows passes data from a pipe to it. So ConPaste may be used here, you only need to copy password asking string.

E.g. in case of 7z.exe archiver: when it needs a password, it writes Enter password: to a console and waits for user input. So when you start it via ConPaste, it asks you for the password and passes it to archiver (other ConPaste flags are not necessary):

Code: Select all

ConPaste.exe "Enter password" 7z.exe <parameters>
You can do the same for your encfs.exe, you only need to know that password input prompt string.
Hurdet
Power Member
Power Member
Posts: 620
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

Do it is possible to add a option to input text with carriage return as in textarea tag in html?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AFAIK it is not supported in command lines so I don't see any practical reasons. Or you know some?
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

If ASkParam.exe is called from within a batch file with parameters how can I differentiate between parameters of the batch file and parameters of AskParam? Currently %1 gives the batch file parameter.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

tbeu,
Usually the rule is the same for all cases of %-parameter handling: if you need to insert % character, you should double it. So, %1 in a batch is first batch parameter while %%1 is string that contains % character and 1.
Post Reply