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
xmeron
Junior Member
Junior Member
Posts: 90
Joined: 2009-06-17, 19:43 UTC

Post by *xmeron »

Sorry, just read your this reply after I posted my message over. I will check this whole thread later.
MVV wrote:AmandaPratt126,
Thank you!
Sorry, there is no complex documentation with tutorials. I've tried to add a Readme but it is very poor yet. However I think you can read entire topic in order to get more examples.
Of course, feel free to ask if you need something special. You only need to provide desired scenario.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, you're right, Readme is needed and it is partially written but not finished yet.
8 modes of show mode only list out 4 of them.
I think it is enough to list most popular modes.
Tried but don't know the difference of /rd and /rl.
Try it again;) second one doesn't allow editing of answers.
The only one example is in help dialog window, but this example cannot be copied
Just press Ctrl+C and Windows will do the rest. :D
Seems because you added %COMMANDER_PATH% to system environment variables, so you can get the right result?
You should start cmd.exe or AskParam from TC, not from Explorer (Start menu) to inherit TC variables.
For the parameter /v, when the dialog width is not default, it is not in the middle of screen, I think centering this dialog should be better.
Jus tried it (1.0.6.136) with different values, all seems to be OK. Please try this one.
And, I wanna use AskParam.exe to implement the function
I think something like this should work (from usercommand or buttonbar button):

Code: Select all

AskParam.exe /t"%N" /p"Rename file:" cmd.exe /c "ren %P%N "%%1""
User avatar
xmeron
Junior Member
Junior Member
Posts: 90
Joined: 2009-06-17, 19:43 UTC

Post by *xmeron »

Your reply is so quick.
Just press Ctrl+C and Windows will do the rest.
Yes, tested and Ctrl+C works, but, these people who are using askparam and don't know to ask help in this forum, may miss this powerful and secret skill. :D
Try it again;) second one doesn't allow editing of answers.
Tried below 2, both TTT are editable:
/tTTT /p /rd
/tTTT /p /rl

=====
You should start cmd.exe or AskParam from TC, not from Explorer (Start menu) to inherit TC variables.
All the tests are under this situation: drag AskParam.exe to buttonbar, fill parameters into TC's parameters text line, then Ok and Click to Run.
Jus tried it (1.0.6.136) with different values, all seems to be OK. Please try this one.
Yes, the dialog is in the center of the screen now, but still has a problem, when the width is too big, the dialog appears in weird place again.

=====
According to your help dialog's parameter's sequence, I put /v after all other parameters, I cannot get final effect after many tries, it confused me for long time until i put /v at the beginning, so
/v800:400 /p ===>effect ok.
/p /v800:400 ===>nothing happened.
the same problem also exist here:
/tTTT /pPPP ===>effect ok.
/pPPP /tTTT ===>TTT disappeared
And, you should tell users that parameter /p is minimal needed parameter(s), otherwise I have to test and test and test again to find what on earth happened.
AskParam.exe /t"%N" /p"Rename file:" cmd.exe /c "ren %P%N "%%1""
Seems only works sometimes, and, especially when SPACE exists inside filename, it will give an error message. I need to try more. :D
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Tried below 2, both TTT are editable:
No, you must prepare to next question before you ask it, and every /p asks a question. So you have to change combobox mode before /p.
until i put /v at the beginning, so
the same problem also exist here:
Yes, same thing: all preparations before asking a question.
All the tests are under this situation: drag AskParam.exe to buttonbar, fill parameters into TC's parameters text line, then Ok and Click to Run.
Ah, got it. You miss the fact that TC can't expand envvars in buttonbar's parameters field, so it cuts all percent sequences. You should twice percent characters in that field (topic contains examples for that place too).
And, you should tell users that parameter /p is minimal needed parameter(s), otherwise I have to test and test and test again to find what on earth happened.
Please describe with more details.
Seems only works sometimes, and, especially when SPACE exists inside filename, it will give an error message.
You should play with percent sequences, also keep in mind that names with spaces must be quoted. You can check command line in CMD.exe process details (in Process Explorer or Process Hacker).
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Small issue with redirection of askParam command

Post by *nsp »

I have a console proggy that output the result in stdout and error in stderr which i commonly redirect to file using 1> 2> and 1>> and 2>> i would like to call it using

Code: Select all

askparam /w /C"My Proggy" /P"Input Scheme" /p"Output File" /p"Otput errLog" myProggy %1 [b]> %2 2>%3[/b]
A) do you have an option to show a kind of file chooser ?
B) do you have specific code to replace redirection ?
C) does it exist a way to have askParam taking parameters from a file ?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

A. File open dialogs are not supported by AskParam. You can only type paths to editbox. And redirection to such file may work if you escape redirect characters to allow them to be passed to AskParam and not processed by the caller (AskParam doesn't process them):

Code: Select all

AskParam.exe /pFile cmd "/c echo wow > %1"
B. What kind of replacing do you mean? AskParam doesn't process redirection characters at all.
C. Are you talking about auto-answering from file? However AskParam can't read anything from files anyway. If you need both using AskParam and answers file, perhaps you should consider writing a batch that will be started using both ways.
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

MVV wrote:A. File open dialogs are not supported by AskParam. You can only type paths to editbox. And redirection to such file may work if you escape redirect characters to allow them to be passed to AskParam and not processed by the caller (AskParam doesn't process them):

Code: Select all

AskParam.exe /pFile cmd "/c echo wow > %1"
B. What kind of replacing do you mean? AskParam doesn't process redirection characters at all.
C. Are you talking about auto-answering from file? However AskParam can't read anything from files anyway. If you need both using AskParam and answers file, perhaps you should consider writing a batch that will be started using both ways.
Thanks a lot for your hint qbout quotting i did not even tried :oops: and for your work !

(C) For parameter file, instead of reading parameter from command line why not having a file from where you read askparam setrting Ex

Code: Select all

/s3
/c My caption
/t C:\
/t D:\,/u
/p Param 01
/p Param 02
Exec "%1" %2 >%TEMP%\outFile.txt &notepad %TEMP%\outFile.tx
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Usually people don't want to have additional files. :D
You can create a simple batch that will merge lines from such parameter file into a single string and then call AskParam.
User avatar
xmeron
Junior Member
Junior Member
Posts: 90
Joined: 2009-06-17, 19:43 UTC

Post by *xmeron »

Yes, same thing: all preparations before asking a question.
Thanks for your explanation, now I finally understand the sequence logic, and, your so much explanation shows that a readme file is necessary indeed. :D
You should play with percent sequences, also keep in mind that names with spaces must be quoted. You can check command line in CMD.exe
I have many long filename's files because I need to put notes/memos into filename for easy searching, I decided to go back to use F6 to rename single file even the F6 function is also a little inconvenient. There are 1 or 2 Single File Renaming Dialog in TC, but seems no call entrance for them. Thanks again.
olafo
Junior Member
Junior Member
Posts: 5
Joined: 2015-06-25, 10:57 UTC

Adjust names of generated environment variables.

Post by *olafo »

Hello MMV,

I would like to set the names for the generated environment variables (AskParam1,...). You could reuse the /e flag.

Example: AskParam /t"Option1" /p"any Option" /e"my_opt" ...
creates the environment variable: my_opt=Option1

I think this would make /e- flag obsolete.

What do you think ?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think this would make /e- flag obsolete.
Thank you for idea, I'll think about it.
BTW I think you misunderstand the meaning of /e key. It does completely different thing. It enables or disables expanding envvars for /t and /u keys.
olafo
Junior Member
Junior Member
Posts: 5
Joined: 2015-06-25, 10:57 UTC

Post by *olafo »

Thank you for taking my proposal into consideration :D ...
and pointing out my mistake. :(

Please let me know whether you implement my proposal.
It would really help some colleagues and me to do our work.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can try test version, I've added it like hints in /t but into /p.

AskParam beta 144

Usage example:

Code: Select all

AskParam /t"Option1" /p(e)"my_opt: any Option" ...
It will put answer into my_opt variable instead of AskParam1.
olafo
Junior Member
Junior Member
Posts: 5
Joined: 2015-06-25, 10:57 UTC

Thank you!

Post by *olafo »

Thanks a lot ! :D
It works as expected. 8)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Can't remember when it was broken but I've fixed it: ^n is replaced with line break in /p prompts allowing multiline questions.

AskParam beta 146
Post Reply