Well im now addicted to Purebasic nad had some troubles for my first application ... its a console-based one , and i learnd to use parameters
ex: reg.exe -n NAME -r REALNAME
btw , i would like to add a reg.exe which will give a detailled help in the same console windows on NT/XP , cause when i RunProgram with cmd.exe and text to echo , it opens another console window :/
my intention so is that the reg.exe -h displays the help in the same XP/NT console mode
thks for your help
Returning txt in the right console ...
Try this:
When compiling, in the compiler options, under executable format choose 'console'. this will make it share a calling console.
Code: Select all
Parameter.s = ProgramParameter()
Procedure DisplayHelp()
PrintN("This is the help text of the application.")
EndProcedure
Procedure DisplayName()
Parameter.s = ProgramParameter()
If Parameter <> ""
PrintN("The NAME parameter given is: " + Parameter)
Else
PrintN("No NAME parameter given. Usage: -n <NAME>")
EndIf
EndProcedure
Procedure DisplayRealName()
Parameter.s = ProgramParameter()
If Parameter <> ""
PrintN("The REALNAME parameter given is: " + Parameter)
Else
PrintN("No REALNAME parameter given. Usage: -r <REALNAME>")
EndIf
EndProcedure
OpenConsole()
While Parameter <> ""
Select LCase(Parameter)
Case "-h"
DisplayHelp()
Break
Case "-n"
DisplayName()
Break
Case "-r"
DisplayRealName()
Break
EndSelect
Wend
End