Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shut down second program when you shut down first one
#1
I have 2 programs running, I would like to get both to close out when one of them closes. Any suggestions?
#2
Need 2 macros.

Macro 1.
Trigger - window destroyed of program 1. Or process ended.
Let the macro close window of program 2.

Macro 2.
Trigger - window destroyed of program 2. Or process ended.
Let the macro close window of program 1.

--------

Example with Notepad and WordPad.

Function close1
Trigger !d"- Notepad" "Notepad"     Help - how to add the trigger to the macro
Code:
Copy      Help
clo "- WordPad"; err

Function close2
Trigger !d"- WordPad" "WordPadClass"     Help - how to add the trigger to the macro
Code:
Copy      Help
clo "- Notepad"; err
#3
Hey Gintaras, I work with JXD011. First i'd like to thank you for your quick response! We've tried the functions you've posted and they work nicely but they're not really performing the operation we need. If we have 2 applications running, 1 app proprietary and driving the other, and by either logging out, selecting close or clicking the windows close (x) button on the proprietary application, we'd like the condition that, in the event of the ending of the task "notepad.exe" or "PID 2240" (master app), a "taskkill" will be performed on "javaw.exe" or "PID 5400" (slave app). Is there a way to create this condition? Or monitor events and then trigger?

Thank you!!
#4
I would use ShutDownProcess "javaw.exe" and ShutDownProcess "NOTEPAD" instead of clo
#5
The trigger is the condition. Do you need without a trigger? Do you create the main program with QM, and can modify it?
#6
We would need a trigger. So when we close out of Notepad, javaw.exe would automatically close as well.
#7
Function close1
Trigger !d"- Notepad" "Notepad"     Help - how to add the trigger to the macro
Code:
Copy      Help
ShutDownProcess "javaw" 2|16
#8
Thank you, I'm getting closer, I have:
close1 ?
clo "- Notepad" ; err
ShutDownProcess "javaw" 2|16


Question, I close notepad but nothing happens, but when i click the run button it works! Also what is the 2|16 doing? It seems slow for javaw to close.
Thanks
#9
Trigger should be !d"- Notepad" "Notepad"
#10
2|16 are flags..

1 - hwndOrExename is process id.
2 - close softly (allow to save data, etc) if not hung. Can wait ~10 seconds.
4 - terminate all processes matching program name.
8 - when waiting, process messages. Use this flag when calling this function from thread that has windows or COM events.
16 (QM 2.2.0) - terminate only process(es) running in current user session (fast user switching).


Forum Jump:


Users browsing this thread: 1 Guest(s)