PDA

View Full Version : Command parameters different when run as bundle



EmbeddedMan
15-09-2015, 15:54
If you run the OS_SampleCommandLine.tbasicc sample by itself on the command line with three arguments, you get this


C:\thinBasic\SampleScripts\OS>thinBasicc OS_SampleCommandLine.tbasicc Arg1 Arg2 Arg3
The following are the passed parameters (param 1 is always script name):
-------------------------------------------------------------------------------
00 [OS_SampleCommandLine.tbasicc Arg1 Arg2 Arg3]
01 [OS_SampleCommandLine.tbasicc]
02 [Arg1]
03 [Arg2]
04 [Arg3]
Press a key to Continue

But if you bundle the script, and then run it like this:

C:\thinBasic\SampleScripts\OS>OS_SampleCommandLine.exe Arg1 Arg2 Arg3

You get the following:

The following are the passed parameters (param 1 is always script name):
-------------------------------------------------------------------------------
00 [Arg1 Arg2 Arg3]
01 [Arg1]
02 [Arg2]
03 [Arg3]
Press a key to Continue

Shouldn't the bundled script act the same as the non-bundled script? With the existing behavior, you have to write special code to detect if you're running as a bundle or not and switch around which arguments are which.

As a separate but related issue, why does the script not see any parameters when invoked as follows?


C:\thinBasic\SampleScripts\OS>OS_SampleCommandLine.tbasicc Arg1 Arg2 Arg3
The following are the passed parameters (param 1 is always script name):
-------------------------------------------------------------------------------
00 ["C:\thinBasic\SampleScripts\OS\OS_SampleCommandLine.tbasicc"]
01 ["C:\thinBasic\SampleScripts\OS\OS_SampleCommandLine.tbasicc"]
Only 1 parameter, program stopped. Press a key to Continue

Is there any documentation on these three forms of command line argument behavior for ThinBasic anywhere? I searched through the help file but couldn't' find anything. (this is with 1.9.15.0)

*Brian

ErosOlmi
15-09-2015, 16:14
Yes, they should be the same but, as you already discovered, bundled executable is a very new feature and there are still bugs.
I will check and fix asap.

I'm currently working on it checking all behaves.

Thanks for reporting
Eros

ErosOlmi
15-09-2015, 20:42
I've fixed different behave of command line.
Now source code execution and bundled executable will work equally.
The only difference will be that when executing from source code, command line will contains script name while from bundled executable it will contain executable name.
I will send you private message when I will have a new version to test


Regarding the last problem where no arguments seems present ... I think it is related on how the operating system detect the application to run in order to execute *.tbasicc extension.
I suppose it is related to the installation instructions I've setup when thinBasic installation is executed.
I have to check it.

EmbeddedMan
15-09-2015, 23:37
Eros,

Yeah, that was my thought too. If you could make all three situations perform identically (or, like you said, the proper differences as to first parameter) it would make coding for command line scripts much simpler.

Thanks-

*Brian