A button that prompts user for input then passes it as a parameter to a command
Moderators: white, Hacker, petermad, Stefan2
A button that prompts user for input then passes it as a parameter to a command
I am trying to create a button that will use a command line tool to compress an image file. The tool takes filename and compression level as parameters. TC can pass the file name but how do I prompt the user for compression level and pass that too?
Re: A button that prompts user for input then passes it as a parameter to a command
Maybe Total Commander has built-in ways to accomplish this, but this should work:
When started, enter your level and press ENTER.
It should show you the command that would be executed.
Change parameters and paths to match your situation.
If the command that is shown looks OK, replace "echo" with "start "" " and replace /k with /c.
(This is largely untested, so I hope I didn't make too many errors ....)
You can also use a ? as the first parameter in your button.
That lets you review and edit the complete command.
When started, enter your level and press ENTER.
It should show you the command that would be executed.
Change parameters and paths to match your situation.
Code: Select all
TOTALCMD#BAR#DATA
C:\Windows\System32\cmd.exe
/k set /p LEVEL=Input level .. & call echo "c:\path to\your program.exe" -file %P%N -level %%LEVEL%% -otheroptions
c:\path to\your program.exe
-1
(This is largely untested, so I hope I didn't make too many errors ....)
You can also use a ? as the first parameter in your button.
That lets you review and edit the complete command.
Re: A button that prompts user for input then passes it as a parameter to a command
In the TC button, just add a question mark as first character in the Parameters field. This will tell TC to show a confirmation dialog for the parameters before launching the command.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: A button that prompts user for input then passes it as a parameter to a command
>> how do I prompt the user for compression level and pass that too?
Also another option is to use MVVs' AskParam
http://totalcmd.net/plugring/askparam.html
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.
Or call an VBS or AHK script from the button and use the scripts InputBox function to ask the user.