|
-
Jan 4th, 2009, 05:17 PM
#1
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
-
Jan 4th, 2009, 05:22 PM
#2
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 4th, 2009, 05:40 PM
#3
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
-
Jan 4th, 2009, 08:34 PM
#4
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
-
Jan 4th, 2009, 09:12 PM
#5
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"))
-
Jan 4th, 2009, 10:32 PM
#6
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
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?
-
Jan 4th, 2009, 10:36 PM
#7
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.
-
Jan 4th, 2009, 11:06 PM
#8
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
-
Jan 5th, 2009, 12:48 PM
#9
Re: Multiple Program Automation
Anyone else know what I can do?
I tried googling it, but I can't seem to find it
Thanks
Last edited by weirddemon; Jan 5th, 2009 at 06:36 PM.
-
Jan 15th, 2009, 12:50 PM
#10
Re: Multiple Program Automation
How about ...
Process.Start(Application.StartupPath & "\Files\test\myotherprogram.exe")
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|