Multiple Program Automation
Hi,
I was wondering if there was a way to launch a string of programs from a button.
I want to be to launch, say 6 programs. Once the first one is done, the code has to know that the first program is done doing it's automated process and then continue.
In VB 6, I used the Shell Execute command to launch a program, but it doesn't work in Vb.Net and I wouldn't even know how to make it launch consecutive programs.
Thanks for any help
Re: Multiple Program Automation
Use the Process class and start a new process to run a program. Then check it exit code or HasExited or WaitForExit property to determine when its done.
Re: Multiple Program Automation
Thanks
I'll take a look at it and see what I come up with. I'll post some code I come up with
:D
Re: Multiple Program Automation
I started playing around with Process.Start and I was wondering if there was a way to open a program without specifying a specific path. If the program or file was located within the same directory, then is there a specific piece of code that could launch it.
Or is there something else I would have to use?
I was reading a bit online and found out that if there's a PATH statement in Windows, then you won't have to specify a path. Like the process for Windows Explorer, iexplore.exe. That's why I was thinking that there might have to be something else that is used to launch it.
Maybe there's a way to link in your resources?
Thanks for the help
Re: Multiple Program Automation
If you specify the name of a file without a qualifying folder path and that file can't be found in any of the folders specified in the PATH environment variable then it is assumed to reside in the application's current working directory. For most .NET applications the initial working directory is the folder that contains the executable, but it doesn't have to be and it can change over the course of a session. For those reasons you should never omit the path of a file unless you specifically want to follow the working directory wherever it may be.
If you specifically want a file in the program folder then you should specify that explicitly:
vb.net Code:
Process.Start(IO.Path.Combine(Application.StartupPath, "myfile"))
Re: Multiple Program Automation
The program that I am making is intended to be used on multiple computers.
The reason that I don't want to specify an exact path, is because the drive letter is always going to change because this application is going to be used on a flash drive.
referring to this statement
Quote:
If you specify the name of a file without a qualifying folder path and that file can't be found in any of the folders specified in the PATH environment variable then it is assumed to reside in the application's current working directory. For most .NET applications the initial working directory is the folder that contains the executable....
If I don't specify the path, the file is located in the directory of the executable, and it doesn't work in debug mode, will it work when I compile the program?
Re: Multiple Program Automation
If the file is in the working directory then it will get executed. If it's not then an exception will be thrown. That's it, plain and simple, whether debugging or not.
Re: Multiple Program Automation
You were right, jmcilhinney. I'm not sure why it didn't work before.
Are you able to name a directory without naming the entire string as long as it is located where the executable is?
For example:
I currently have this:
Code:
Process.Start("test")
I want to be able put my files in a sub folder for neatness.
I tried this:
Code:
Process.Start("Files\test")
But it doesn't work. Probably just something I'm doing wrong :P
Re: Multiple Program Automation
Anyone else know what I can do?
I tried googling it, but I can't seem to find it
Thanks
Re: Multiple Program Automation
How about ...
Process.Start(Application.StartupPath & "\Files\test\myotherprogram.exe")