By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,538 Members | 890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,538 IT Pros & Developers. It's quick & easy.

Any idea about how can i create something like this?

P: 1
I want to create an app that helps me to automate opening consecutive .exe files.

The general blueprint: Open the initial app -> Start -> Open .exe #1 -> Click next -> Close .exe #1 & Open .exe #2 [...]

Sorry, but I am a complete newbie.
Feb 20 '20 #1
Share this Question
Share on Google+
2 Replies


100+
P: 110
This code is vb.net.
This code launches three applications(Notepad,cmd,mspaint) in sequence by pressing button 1.
It return to start when all three applications have been executed.
Expand|Select|Wrap|Line Numbers
  1.     Dim Program() As String = {"Notepad", "cmd", "mspaint"}    
  2.     Dim MaxProgram As Integer = Program.Length
  3.     Dim Counter As Integer
  4.     Dim hPros As System.Diagnostics.Process
  5.     Public Sub New()
  6.         Me.InitializeComponent()
  7.         button1.Text = "Start"
  8.         Counter = 0
  9.     End Sub
  10.  
  11.     Sub Button1Click(sender As Object, e As EventArgs)
  12.         If Counter = 0 then
  13.             'Exec App and Get Process Instance
  14.             hPros = System.Diagnostics.Process.Start(Program(Counter))
  15.             Counter = Counter + 1
  16.             button1.Text = "Next"
  17.         Else If Counter <= MaxProgram Then
  18.             'Find Execut process in all processes
  19.             Dim ps As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcesses()                
  20.             For Each p As System.Diagnostics.Process In ps
  21.                 If p.id = hPros.Id Then
  22.                     'Kill Process
  23.                     hPros.Kill()
  24.                     Exit for
  25.                 End If
  26.             Next
  27.              'Close and Dispose
  28.             hPros.Close()
  29.             hPros.Dispose()
  30.             If Counter < MaxProgram Then
  31.                 hPros = System.Diagnostics.Process.Start(Program(Counter))
  32.                 Counter = Counter + 1
  33.                 button1.Text = "Next"
  34.             Elseif Counter = MaxProgram
  35.                 'Restart
  36.                 button1.Text = "Start"
  37.                 Counter = 0    
  38.             End If
  39.         End If        
  40.     End Sub
Feb 21 '20 #2

P: 14
Process.Start("application1");
Process.Start("application2");
Process.Start("application3");
4 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.