PDA

View Full Version : Allow user to set command line arguments


D0M1N0R
09-30-2006, 06:15 AM
Does anyone know of a way to allow the users of the program to enter their own custom command line arguments when i.e. pressing a button to launch something. Either by typing it into a field at first, then pressing a launch button, or preferably by pressing the launch button, then type the arguments into a new field that appears then..

Just something like that, no specific needs but just that they can enter their own arguments, or at least modify a part or add something to it?

Any help would be greatly appriciated!

Roboblue
09-30-2006, 08:37 AM
Maybe something like this would work if the user knew what arguments to use

Button On Click
sCommand = Dialog.Input("Enter Argument", "Your answer:", "", MB_ICONQUESTION);
if sCommand ~= "CANCEL" then
result = File.Run("AutoPlay\\Docs\\MyProg.exe", sCommand, "", SW_SHOWNORMAL, false);
end

D0M1N0R
09-30-2006, 10:14 AM
It got me a little closer at least:lol

Would there be a way to allow users to enter the command line arguments using a batch file?

i.e. having it say something like
app.exe +connect
before the user enters anything, and when the user enter an ip, it would be as if you wrote app.exe +connect 12.34.56.78 in it?

Roboblue
09-30-2006, 10:42 AM
You could just add it as a string plus variable.
(use a space before and after + connect).See in red

CODE]sCommand = Dialog.Input("Enter Argument", "Your answer:", "", MB_ICONQUESTION);
if sCommand ~= "CANCEL" then
result = File.Run("AutoPlay\\Docs\\MyProg.exe", " +connect "..sCommand.."", "", SW_SHOWNORMAL, false);
end[/CODE]

D0M1N0R
10-01-2006, 09:45 AM
Got it working now, thanks a whole lot:)
I think at least;) Will post if I get more trouble

D0M1N0R
10-01-2006, 10:02 AM
Never mind,, GOT IT WORKING :D:D:D

sCommand = Dialog.Input("Connect to server", "Server IP:", "defualtdisplaytext", MB_ICONQUESTION);
if sCommand ~= "CANCEL" then
Folder.SetCurrent("AutoPlay\\Docs\\appfolderifneeded")
result = File.Run("AutoPlay\\Docs\\app.exe", " +connect "..sCommand.."", "", SW_SHOWNORMAL, false);
end


Just in case someone else would need something like this

Intrigued
10-01-2006, 10:10 AM
Never mind,, GOT IT WORKING :D:D:D

sCommand = Dialog.Input("Connect to server", "Server IP:", "defualtdisplaytext", MB_ICONQUESTION);
if sCommand ~= "CANCEL" then
Folder.SetCurrent("AutoPlay\\Docs\\appfolderifneeded")
result = File.Run("AutoPlay\\Docs\\app.exe", " +connect "..sCommand.."", "", SW_SHOWNORMAL, false);
end


Just in case someone else would need something like this

Nice one there. :yes

Lorne
10-02-2006, 11:35 AM
You can also get the command line arguments that were given to your AutoPlay application by using _CommandLineArgs.

From the help file:
_CommandLineArgs
A numerically indexed table that contains the command line arguments passed into the AutoPlay application.