parameter at the begining ot applicaton


Author
Message
Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Hi,

I just want to launch my application wiht some parameters

like monappli.exe /param1 /param2

How can i do that ?

thanks

Best regards

Eric
Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
hi,Hello, anyone has idea for parameters launches? thanks best regards
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sure, using parameters is a great idea to add in automated features into an executable.  This is something that I do regularly, but depending on your approach, can be a little work.  I like to create a command line class that can parse the inbound parameters.

To begin, start with the AppMain.vb or program.cs (if you are using an SF project).  Otherwise, just go to your main program entry point.

You can then call the GetCommandLineArgs() if you are running in a WinForms environment.  If you are running in a console app environment, the args will be passed in through the Main entry point as a parameter.

Environment.GetCommandLineArgs()


Next, you can pass these args into a parser that lines up with your desired command line logic.  I will generally write RegEx methods to parse the command line based on what I am expecting coming in and then place that into a collection that has the name and value. 

Hope this helps get you started.
Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Hi Trent

Thanks a lot

Its cool

in the attachement file, (paramstrata.exe)  the video résult.

i put this code in the appmain.vb ( just to understand )


<
STAThread()> _
Public Shared Sub Main()
' -- récupération des paramtres de lancements
Dim toto() As String
toto = Environment.GetCommandLineArgs()
Dim nbparam As Integer
nbparam = toto.Length
If nbparam > 1 Then
For i = 0 To nbparam - 1
MsgBox(toto(i) &
CStr(toto.Length))
Next
End If

 

It running verry well
im going to put a contrib on www.strataframe.fr

Thanks

Best regard


Attachments
paramstrata.exe (148 views, 2.00 MB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad you got it going!  Thanks for all of your contributions to the forum!!!  Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search