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: Stefan2, white, sheep, Hacker

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

AskParam: Asks for command-line parameters via GUI dialog

Post by *MVV » 2012-03-12, 13:19 UTC

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 2015-06-20, 14:25 UTC, edited 4 times in total.

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

Post by *MVV » 2012-03-12, 13:27 UTC

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 » 2012-03-12, 13:47 UTC

:D

i am happy.

thank you MVV i wish you a nice happy week.
#181344 Personal licence

seb-
Senior Member
Senior Member
Posts: 272
Joined: 2011-11-15, 06:14 UTC
Location: DE\BN

Post by *seb- » 2012-03-12, 14:07 UTC

Works perfectly :-)

Thanks for this QUICK feature-request to implementation time ;-)

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

Post by *MVV » 2012-03-12, 15:59 UTC

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 » 2012-03-18, 10:50 UTC

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: 8259
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2012-03-18, 14:11 UTC

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 » 2012-03-18, 18:27 UTC

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: 8259
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2012-03-19, 06:41 UTC

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: 1201
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp » 2012-03-19, 09:31 UTC

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: 8259
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2012-03-19, 10:13 UTC

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
Senior Member
Senior Member
Posts: 431
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet » 2012-09-25, 19:04 UTC

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: 8259
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2012-09-26, 06:08 UTC

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: 1229
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu » 2012-12-17, 09:24 UTC

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 Preview, Autodesk Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, SolidWorks Preview and more

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

Post by *MVV » 2012-12-17, 15:45 UTC

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