PB4 - Complete ProgramParameter information

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

PB4 - Complete ProgramParameter information

Post 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)
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Why not simply use the GetCommandLine_() api for that ?
quidquid Latine dictum sit altum videtur
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post 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 "_" :?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Code: Select all

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

Debug GetCompleteCommandLine () 
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Hroudtwolf wrote:

Code: Select all

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

Debug GetCompleteCommandLine () 
Thanks! :roll:
Post Reply