Since everybody has been so helpfull, I thought I could make a contribution to help the other newbies to PureBasic.
Just thought this could help someone else. Nothing fancy.
Code: Select all
; Example of using the command 'ProgramParameter()'
;
; In this example, the linklist is named 'PG_Parms'
; The procedure to get the parameters of the
; command is 'Get_Prog_Params()'
;
; And the returned value, from the procedure is the
; number of elements (thus the number of parameters)
; in the linklist.
;
; App has been tested under W98SE, 800Mhz, 256Mb Memory
; Use as you wish and as usual,
; NO WARRENTY IS IMPLIED OR OFFERED
; USE AT YOUR OWN RISK!!!
;
num_parm.w = 0
x_var.w = 0
Stuff.s = " "
Procedure.w Get_Prog_Params()
Protected x1.w, a1.s
a1 = Space(255)
x1 = 0
NewList PG_Parms.s()
Repeat
a1 = ProgramParameter()
If Len(a1) > 0
AddElement(PG_Parms())
PG_Parms() = a1
EndIf
Until Len(Trim(a1)) < 1
x1 = CountList(PG_Parms())
FirstElement(pg_parms())
ProcedureReturn x1
EndProcedure
If OpenConsole()
num_parm = get_prog_params()
PrintN("Number of elements in the Linklist = " + Str(num_parm) + " .")
stuff = input()
printn(" ")
if num_parm > 0
For x_var = 1 To Num_Parm
PrintN("Element number : " + Str(x_var) + ", in the Linklist.")
PrintN("Element Value : " + PG_Parms() + ", in the Linklist.")
NextElement(pg_parms())
printn(" ")
Next x_var
EndIf
input()
EndIf
End
HarryO