How can I make a program start when another program opens?

Page 2 of 2 FirstFirst 12

  1. Posts : 10,485
    W7 Pro SP1 64bit
       #11

    See if this works for you.

    Code:
    Opt("TrayIconDebug", 1)
    Opt("WinTitleMatchMode", 2)
    
    $Notepad = "no"
    $WordPad = "no"
    $Calculator = "no"
    $Paint = "no"
    
    While 1
        Sleep(50)
    
        If WinExists("Notepad") And $Notepad = "no" Then
            Run("c:\windows\system32\calc.exe")
            WinWait("Calculator")
            $Notepad = "yes"
            $Calculator = "yes"
        EndIf
        If Not WinExists("Notepad") And $Calculator = "yes" Then
            WinClose("Calculator")
            WinWaitClose("Calculator")
            $Notepad = "no"
            $Calculator = "no"
        EndIf
    
        If WinExists("WordPad") And $WordPad = "no" Then
            Run("c:\windows\system32\mspaint.exe")
            WinWait("Paint")
            $WordPad = "yes"
            $Paint = "yes"
        EndIf
        If Not WinExists("WordPad") And $Paint = "yes" Then
            WinClose("Paint")
            WinWaitClose("Paint")
            $WordPad = "no"
            $Paint = "no"
        EndIf
    WEnd
      My Computer


  2. Posts : 6
    Windows 7 x64
    Thread Starter
       #12

    UsernameIssues said:
    See if this works for you.

    Code:
    Opt("TrayIconDebug", 1)
    Opt("WinTitleMatchMode", 2)
    
    $Notepad = "no"
    $WordPad = "no"
    $Calculator = "no"
    $Paint = "no"
    
    While 1
        Sleep(50)
    
        If WinExists("Notepad") And $Notepad = "no" Then
            Run("c:\windows\system32\calc.exe")
            WinWait("Calculator")
            $Notepad = "yes"
            $Calculator = "yes"
        EndIf
        If Not WinExists("Notepad") And $Calculator = "yes" Then
            WinClose("Calculator")
            WinWaitClose("Calculator")
            $Notepad = "no"
            $Calculator = "no"
        EndIf
    
        If WinExists("WordPad") And $WordPad = "no" Then
            Run("c:\windows\system32\mspaint.exe")
            WinWait("Paint")
            $WordPad = "yes"
            $Paint = "yes"
        EndIf
        If Not WinExists("WordPad") And $Paint = "yes" Then
            WinClose("Paint")
            WinWaitClose("Paint")
            $WordPad = "no"
            $Paint = "no"
        EndIf
    WEnd
    Thanks so much its working perfectly!
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:01.
Find Us