473,287 Members | 1,501 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,287 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 4250

"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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.