Interesting question,
I think lot of people would like to do this ... and it is possible
This functionality is handled by OS module, by functions:
- OS_GetCommand
- OS_GetCommands
- OS_CommandPresent
- OS_CommandsGetSep
- OS_CommandsSetSep
You can read more about them in the help file + see the sample code thinBasic\SampleScripts\OS\OS_SampleCommandLine.tBasic.
Here more elemental example to handle your task:
Uses "OS" ' -- For command line handling
Uses "Console"
Long i
' -- When launched from thinAir, the first param is @1 and the second name of the script
' -- When launched independently, the first param is name of the script
For i = 1 To OS_GetCommands
PrintL "Parameter #"+Format$(i), OS_GetCommand(i)
PrintL
Next
' -- Because of this behavior, the parameters we need are the prev-to-last and last one
Single param1 = OS_GetCommand(OS_GetCommands-1)
Single param2 = OS_GetCommand(OS_GetCommands)
MsgBox 0, "Number #1 = " + Format$(param1) + $CRLF +
"Number #2 = " + Format$(param2)
WaitKey
To test how it works, simply enter this in ThinAir, and then click Script/Command line and enter the two numbers separated by space.
Petr
Bookmarks