473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Passing multiple (dynamic) external arguments to app

Greets all. I'm attempting to write an app that will be used as a
'control/launcher' application for other apps. For the sake of argument
let's say the app is launched from a command line:

controlapp externalapp argument1 argument2 argument3 argument4...etc.
(number of arguments is ALWAYS dynamic)

I'm been able to get the array passed properly, but ONLY when I know in
advance the amount of items in the array. I'm stuck on how to allow for
any amount of arguments.
Dim applaunch As Process = New Process()
Dim arrayCount As Integer, appArgs() As String

'pull external exe path/name and arguments into array, then count array
items
appArgs = System.Environment.GetCommandLineArgs
For arrayCount = 0 To UBound(appArgs)
Next arrayCount

'command line = controlapp externalapp argument1 argument2 argument3
'I start at 2nd item in array, as appargs(0) = controlapp
applaunch.StartInfo.FileName = appArgs(1)
applaunch.StartInfo.Arguments = appArgs(2) & " " & appArgs(3) & " " &
appArgs(4)
Hopefully this is enough of the code to figure out what my next step should
be. I'm learning as I go with vb.net, so if I missed an incredibly obvious
solution, please be gentle! Additionally, is this even a good way of doing
it? Thanks in advance!
Nov 21 '05 #1
2 4255

"pyrexia" <py*****@hotmail.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
Greets all. I'm attempting to write an app that will be used as a
'control/launcher' application for other apps. For the sake of argument
let's say the app is launched from a command line:

controlapp externalapp argument1 argument2 argument3 argument4...etc.
(number of arguments is ALWAYS dynamic)

I'm been able to get the array passed properly, but ONLY when I know in
advance the amount of items in the array. I'm stuck on how to allow for
any amount of arguments.
Dim applaunch As Process = New Process()
Dim arrayCount As Integer, appArgs() As String

'pull external exe path/name and arguments into array, then count array
items
appArgs = System.Environment.GetCommandLineArgs ******** What does this loop do ? ************************ For arrayCount = 0 To UBound(appArgs) ********** why not add something in the loop like ***********************
applaunch.StartInfo.Arguments = applaunch.StartInfo.Arguments & "
" & appArgs(arrayCount)
*********************************************** Next arrayCount

'command line = controlapp externalapp argument1 argument2 argument3
'I start at 2nd item in array, as appargs(0) = controlapp
applaunch.StartInfo.FileName = appArgs(1)
applaunch.StartInfo.Arguments = appArgs(2) & " " & appArgs(3) & " " &
appArgs(4)
Hopefully this is enough of the code to figure out what my next step should be. I'm learning as I go with vb.net, so if I missed an incredibly obvious
solution, please be gentle! Additionally, is this even a good way of doing
it? Thanks in advance!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.769 / Virus Database: 516 - Release Date: 9/25/2004
Nov 21 '05 #2
Pyrexia,

Probably will this do the Job for you.

\\\
Public Sub MySub(ByVal ParamArray Args() As String)
'....Args is just an array with unknow lenght of strings in this case
End sub
////

I hope this helps?

Cor

"pyrexia"
Greets all. I'm attempting to write an app that will be used as a
'control/launcher' application for other apps. For the sake of argument
let's say the app is launched from a command line:

controlapp externalapp argument1 argument2 argument3 argument4...etc.
(number of arguments is ALWAYS dynamic)

I'm been able to get the array passed properly, but ONLY when I know in
advance the amount of items in the array. I'm stuck on how to allow for
any amount of arguments.
Dim applaunch As Process = New Process()
Dim arrayCount As Integer, appArgs() As String

'pull external exe path/name and arguments into array, then count array
items
appArgs = System.Environment.GetCommandLineArgs
For arrayCount = 0 To UBound(appArgs)
Next arrayCount

'command line = controlapp externalapp argument1 argument2 argument3
'I start at 2nd item in array, as appargs(0) = controlapp
applaunch.StartInfo.FileName = appArgs(1)
applaunch.StartInfo.Arguments = appArgs(2) & " " & appArgs(3) & " " &
appArgs(4)
Hopefully this is enough of the code to figure out what my next step
should
be. I'm learning as I go with vb.net, so if I missed an incredibly obvious
solution, please be gentle! Additionally, is this even a good way of doing
it? Thanks in advance!

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
20
by: Gregory Piñero | last post by:
Hey guys, would someone mind giving me a quick rundown of how references work in Python when passing arguments into functions? The code below should highlight my specific confusion: <code> ...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
6
by: dharmadam | last post by:
Is it possible to pass a column name or the order of the column name in the DB2 table table function. For example, I want to update the address of a person by passing one of the address column name...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
2
by: Colmag | last post by:
I'm running a console application (ghostscript) by starting it as a process with arguments. The problem i'm having is that it's falling over when I pass a file containing spaces in the filename...
7
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been...
9
by: zholthran | last post by:
Hi folks, after reading several threads on this issue (-> subject) I fear that I got a problem that cannot easily be solved by the offered workarounds in an acceptable way, at least not with my...
1
by: rottmanj | last post by:
I am working on an application that requires me to use an external application to pull data from a odbc proxy. One issue that I have run into is trying to figure out how to pass data from my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.