LB Booster
« command line »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:30am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: command line  (Read 425 times)
Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx command line
« Thread started on: Feb 5th, 2017, 4:38pm »

LB4 can pass parameters to a tokenized program, that are read in the called program using the command "ComandLine$"

If LBB does not have this capability, can I pass a small amount of information to an LBB compiled program (.exe) in a similar manner?

I am not talking about command line switches here. I want to avoid writing a file in the calling program and reading it in the called program.

r.m.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: command line
« Reply #1 on: Feb 5th, 2017, 6:10pm »

Hi r.m. alincon,

The special system variable 'CommandLine$' will contain all characters passed to the .exe file at run time. Let me know if you need an example.

Jack
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: command line
« Reply #2 on: Feb 5th, 2017, 9:16pm »

Okay, show me your example.
I just tried my program again in LB4.5, once with .tkn which received the parameter and worked, and once with ".exe" which apparently did not receive the parameter and did not work.
I tried the program with LBB with "exe" and it failed.
LBB does not work with 'tkn' as far as I know.

Maybe there are some differences between LB45 .exe and LBB .exe.

r.m.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: command line
« Reply #3 on: Feb 5th, 2017, 10:57pm »

Compile the following two line program to 'test.exe'.

Code:
print CommandLine$
wait
 


Next, compile the following one line program to 'test2.exe'.

Code:
run "test.exe <Put your command line data here.>"
 


Finally, run 'test2.exe' from Windows. It works.

The 'run' statement in 'test2.bas' will not work from the LBB IDE, only from Windows.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: command line
« Reply #4 on: Feb 6th, 2017, 08:33am »

on Feb 5th, 2017, 10:57pm, Jack Kelly wrote:
The 'run' statement in 'test2.bas' will not work from the LBB IDE, only from Windows.

Can you explain what you mean by that? Of course you can run the code listed as test2.bas from the LBB IDE, and if you do it works perfectly (tested here, not that there was ever any doubt about it).

Unlike LB 4, running code from the IDE is not significantly different from compiling it and running the EXE - in the case of LBB they both run as separate processes.

What you are possibly getting confused with is that if you try to use the LBB run-time engine (LBBRUN.exe) in conjunction with a tokenized program (say test.lbb in this case) then it is true that you cannot use CommandLine$.

That has been on my list of things to fix for (literally) years, but since virtually nobody ever uses tokenized LBB programs (they offer no real benefit over compiled EXEs and the security is very poor) it's a low priority for me.

Richard.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: command line
« Reply #5 on: Feb 6th, 2017, 12:55pm »

I wasn't using tokenized files. My confusion arose because I was running 'test2' from the IDE without having saved it to a .bas file first. When I did that it did work correctly. I'm running under XP.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: command line
« Reply #6 on: Feb 6th, 2017, 3:20pm »

Well, I'm still confused, and I can not get my .exe program to work by calling it from my .bas program in the LBB or LB4.5 IDE.

I am depending on the "special variable" CommandLine$ to receive a few characters of information, and apparently, it does not.

Does LBB recognize "CommandLine$" as a 'spercial variable' or not?
I was unable to find it in among the statements, functions, etc.

Should I just communicate by a small file, rather than try to pass parameters along with the call?

r.m.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: command line
« Reply #7 on: Feb 6th, 2017, 9:28pm »

Alincon, did my example work for you or not? It works for both Richard and I, and demonstrates exactly how CommmandLine$ works in LBB.

Your programs might not work for any number of reasons. Start with one small step at a time and you should be able to figure it out.

Jack
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: command line
« Reply #8 on: Feb 6th, 2017, 9:54pm »

on Feb 6th, 2017, 12:55pm, Jack Kelly wrote:
My confusion arose because I was running 'test2' from the IDE without having saved it to a .bas file first. When I did that it did work correctly.

The only significance of that is the setting of your 'default directory' (DefaultDir$). Saving the program sets DefaultDir$ to where you saved it. If you had specified an absolute path to test.exe in the RUN command it would have worked whether the program was saved or not.

Richard.
« Last Edit: Feb 6th, 2017, 9:55pm by Richard Russell » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls