Page 1 of 1

PB4 - Complete ProgramParameter information

Posted: Wed Mar 22, 2006 12:35 pm
by Michael Vogel
Hi, I'm accepting, that the function call ProgramParameter must not deliver exactly what the given Parameter has been, but I'm still searching for a possibility to pass parameters through to another program...

For instance I have the following situation: for a program, let's call it "statistic.exe" some initial data have to be produced before calling it and after the execution the data is converted. So I did a purebasic program "mystarter.exe" which should do the following:

Code: Select all

; Init
; [:]

; Call Programm
; WinExec_("c:\progra~1\intern~1\server\statistik.exe "+GetCommandLine(),WM_HIDE)

; Data-Convertion
; [:]
And now the problem:
I have to pass through parameters like (quotes are important):

-a 2 "x" Time_Axis "y" X_Axis

so how to create the correct commandline easily?

A lot of words for the easy wish: please change ProgramParameter() to have the following behaviour:

ProgramParameter() next parameter
ProgramParameter(0) complete (unmodified) parameter string
ProgramParameter(n) nth parameter (1..CountProgramParameters())

So what would change for actual sources?
ProgramParameter(n-1) will now be ProgramParameter(n)

Posted: Wed Mar 22, 2006 1:32 pm
by freak
Why not simply use the GetCommandLine_() api for that ?

Posted: Wed Mar 22, 2006 7:25 pm
by Michael Vogel
freak wrote:Why not simply use the GetCommandLine_() api for that ?
You're right! Found it in the WIN32 help file, but forgot to add the "_" :?

Posted: Wed Mar 22, 2006 9:55 pm
by Hroudtwolf

Code: Select all

Procedure.s GetCompleteCommandLine ()
    ProcedureReturn Trim(StringField (PeekS(GetCommandLine_()),3,Chr(34)))
EndProcedure

Debug GetCompleteCommandLine () 

Posted: Thu Mar 23, 2006 11:14 am
by Michael Vogel
Hroudtwolf wrote:

Code: Select all

Procedure.s GetCompleteCommandLine ()
    ProcedureReturn Trim(StringField (PeekS(GetCommandLine_()),3,Chr(34)))
EndProcedure

Debug GetCompleteCommandLine () 
Thanks! :roll: