PDA

View Full Version : Command help



ThomasAnderson
10-18-2008, 11:38 AM
I making a project that includes giving commands
There are 2 inputs
I wanna make it when someone enters a unknown command it will show
Unknown Command at Input1
Code:

if(e_Key==13)then
sCommand=Input.GetText(this);
sCommand=String.Replace(sCommand, "\r\n", "", false);
if(sCommand=="minimize")then
Input.SetText("Input1", "The program will now minimize");
Application.Minimize();
Input.SetText("Input2", "");
end
end

Input2 is the place where u write commands and Input1 is the place where it shows the text like this for ex: The program will now minimize or what ever.
Thanks in advance.

Centauri Soldier
10-18-2008, 12:49 PM
Could you please upload your project (apz) file so we forum browsers can open it for ourselves?

(Goto File -> Export to get the project archive file)

Thanks,
CS.

ThomasAnderson
10-18-2008, 12:56 PM
Here it is:

Centauri Soldier
10-18-2008, 01:54 PM
Ok, so here's what I came up with. Basic, but I think that it's what you're looking for. I didn't comment the code but it's all pretty self-explanatory.

You'll find the new code on the On Preload section and in your Input2 object.

BTW, I taught myself to program and as such have not had the benefit of proper training. That said, I have never heard of "this" until I was looking at your project. Thanks much, that is a powerful command. I lived without it but I see that it was not easy now that I know what "this" can do.

I would recommend trying to put your command list into an xml file so the user can add custom commands and your program can be easily updated.

Oh, and hide that button at runtime...unless you like the color :).

Centauri Soldier
10-18-2008, 01:55 PM
forgot the file...:rolleyes