Files selection to command line script
Posted: 04 Feb 2016 11:42
Hello!
I have a dos command line program (SetDPI.exe) that manually sets the DPI to PNG files.
Syntax:
SetDPI dpiX dpiY filepattern [filepattern [filepattern...]]
How can I set up a script that:
1) Tests that the files selected really exist
2) wrap double quotes around each file
3) Interactively ask for my wanted DPI. If I give only one input number, then duplicate that number (dpiX dpiY)
4) Check if inputs (space delimited) are numbers (0 up to 1000, decimals permitted, for example 200.34)
5) feed the output list to SetDPI and execute it.
6) pause at the end so that the DOS windows does not disappear.
For example, I want to change the DPI to the following three files which are present to a folder with some other files too:
Test1.png
Test 2.png
test 3.really a png but with a differect extension.txt
I should select those three, use the script which will ask me the desired dpi (for example 300.33) and then execute the following command:
SetDPI 300.33 300.33 "Test1.png" "Test 2.png" "test 3.really a png but with a differect extension.txt"
If I give two numbers (for example 300.33 200.22), then execute the following command:
SetDPI 300.33 200.22 "Test1.png" "Test 2.png" "test 3.really a png but with a differect extension.txt"
Thank you!
I have a dos command line program (SetDPI.exe) that manually sets the DPI to PNG files.
Syntax:
SetDPI dpiX dpiY filepattern [filepattern [filepattern...]]
How can I set up a script that:
1) Tests that the files selected really exist
2) wrap double quotes around each file
3) Interactively ask for my wanted DPI. If I give only one input number, then duplicate that number (dpiX dpiY)
4) Check if inputs (space delimited) are numbers (0 up to 1000, decimals permitted, for example 200.34)
5) feed the output list to SetDPI and execute it.
6) pause at the end so that the DOS windows does not disappear.
For example, I want to change the DPI to the following three files which are present to a folder with some other files too:
Test1.png
Test 2.png
test 3.really a png but with a differect extension.txt
I should select those three, use the script which will ask me the desired dpi (for example 300.33) and then execute the following command:
SetDPI 300.33 300.33 "Test1.png" "Test 2.png" "test 3.really a png but with a differect extension.txt"
If I give two numbers (for example 300.33 200.22), then execute the following command:
SetDPI 300.33 200.22 "Test1.png" "Test 2.png" "test 3.really a png but with a differect extension.txt"
Thank you!