Welcome, Guest. Please login or register.

Author Topic: Blitz Basic: Reading arguments from the command line  (Read 2750 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Blitz Basic: Reading arguments from the command line
« on: May 26, 2006, 08:01:14 AM »
I've scoured the Blitz manual and searched online but I can't find an answer to this... How on earth do I read command line arguments from Blitz?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Blitz Basic: Reading arguments from the command line
« Reply #1 on: May 26, 2006, 07:06:26 PM »
Thanks! I didn't think of searching the document for "parameter" :roll: I guess the command I'm looking for is "par$(parameter)". So if I ran the programme like this:

1.>myprog arg1=value

Then the command "str$=par$(arg1)" would set the variable str$ to "value". Right???

Thanks

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Blitz Basic: Reading arguments from the command line
« Reply #2 on: May 26, 2006, 08:00:32 PM »
Ok, got it working by using "b$=Par$(1)". Now, is there any way to convert the string variable b$ to a byte variable so I can pass it to the parallel port?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Blitz Basic: Reading arguments from the command line
« Reply #3 on: May 26, 2006, 08:27:40 PM »
That works - thanks! :-) I had to add a "%" to the beginning of the string, but then it worked.

When I create an executable from the "Compiler" menu and then run the programme from the shell, it doesn't do anything. The relays don't change. If I run it inside Blitz then it works. Why might this be?

--
moto

--EDIT
Forget that, I think I just had to close the Blitz editor as it was hogging the port. It's all working now  :-D  :-D  :-D  Thanks a lot for your help guys!!!
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10