1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

script to make a program run with another program

Discussion in 'Windows XP' started by sniper9228, 2008/03/27.

  1. 2008/03/27
    sniper9228

    sniper9228 Well-Known Member Thread Starter

    Joined:
    2005/08/31
    Messages:
    615
    Likes Received:
    1
    Is it possible to have program 1 run as program 2 starts and then have program 1 exit when program 2 exits?
     
  2. 2008/03/27
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23

  3. to hide this advert.

  4. 2008/03/27
    sniper9228

    sniper9228 Well-Known Member Thread Starter

    Joined:
    2005/08/31
    Messages:
    615
    Likes Received:
    1
    wow, is there any easier way
     
  5. 2008/03/27
    Steve R Jones

    Steve R Jones SuperGeek Staff

    Joined:
    2001/12/30
    Messages:
    12,279
    Likes Received:
    246
    What are the names of these two applications?
    And is clicking two icons to start the programs really that much work:)
     
  6. 2008/03/27
    sniper9228

    sniper9228 Well-Known Member Thread Starter

    Joined:
    2005/08/31
    Messages:
    615
    Likes Received:
    1
    msimn.exe
    and
    snoe.exe
     
  7. 2008/03/27
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23
    It actually pretty easy. Just copy that script they offer and paste it into a Notepad session. Then edit it to change the example programs they used to conform to your programs. You will probably have to include the full path on your programs where their .exe programs are listed. Then save it as a .vbs file.

    If you need help doing it, post back with the full paths of your programs and I'll script it for you.
     
  8. 2008/03/27
    sniper9228

    sniper9228 Well-Known Member Thread Starter

    Joined:
    2005/08/31
    Messages:
    615
    Likes Received:
    1
    C:\Program Files\Cloudmark\SpamNet\OE snoe.exe
    C:\Program Files\Outlook Express msimn.exe
     
  9. 2008/03/27
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23
    OK, then the script would look like this:

    Code:
    strComputer =  ". "
    Set objWMIService = GetObject( "winmgmts:\\" & strComputer &  "\root\cimv2:Win32_Process ")
     
    errResult = objWMIService.Create( "C:\Program Files\Outlook Express\msimn.exe ", null, null, intMsimnID)
    errResult = objWMIService.Create( "C:\Program Files\Cloudmark\spamnet\OE\snoe.exe  ", null, null, intSnoeID)
    
    Set objWMIService = GetObject( "winmgmts:\\" & strComputer &  "\root\cimv2 ")
    
    Set colProcesses = objWMIService.ExecNotificationQuery _
        ( "Select * From __InstanceDeletionEvent " _ 
                &  "Within 1 Where TargetInstance ISA 'Win32_Process' ")
    
    Do Until i = 999
        Set objProcess = colProcesses.NextEvent
        If objProcess.TargetInstance.ProcessID = intMsimnID Then
            Exit Do
        End If
    Loop
    
    Set colProcesses = objWMIService.ExecQuery _
        ( "Select * from Win32_Process Where ProcessID = " & intSnoeID)
    
    For Each objProcess in colProcesses
        objProcess.Terminate()
    Next
    
    
    Copy that and paste it into a Notepad session and save it as YouNameIt.vbs.

    If you want, I can post that file to my web space and you can download it. It's no trouble.

    EDIT, I gotta run so I'll post the file for you to download in case you need it:

    Get it here.
     
    Last edited: 2008/03/27
  10. 2008/03/27
    sniper9228

    sniper9228 Well-Known Member Thread Starter

    Joined:
    2005/08/31
    Messages:
    615
    Likes Received:
    1


    Thank you very much. This is just what I need.
     
  11. 2008/03/30
    harshadd

    harshadd Inactive

    Joined:
    2008/03/30
    Messages:
    11
    Likes Received:
    0
    Hey I was also looking for similar thing, only diff is I want to open 5-6 applications together and close all of them together if either of them is closed.
    ie. If any one is closed all should closed.
    can this script be modified to serve me ??
    Thanks in advance

    RGds
    HarshadD
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.