Start application A when application B quits

Joined
Nov 9, 2012
Messages
5
Reaction score
0
Points
1
Hi all,

I've done a small Automator application that fits my needs. However, I would need it to start when a certain application quits. How can I do that? Can I use Automator? How? Otherwise, what are my options? I must tell you I'm a real newcomer to Automator, Applescript or all those.

Thanks a lot,

Blaccko
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,609
Reaction score
1,076
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Ventura, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
Are the applications involved always the same ones? So, strictly as an example, Mail is always quit before Safari opens? If so the following should work.

Make sure that the Automator application that you built has been saved as an application. Launch Automator and choose to build an Application when it asks what you want to create, Then do the following steps:

1. Search the Automator library for a "Quit Application" action and move it to the right side of the Automator window. Don't use the Quit All Applications action.
2. In the drop down menu for that action choose the program that you want to quit.
3. Search for a Launch Application action and add it to the window just beneath the first. Select the Automator application that you want to launch.

Test the workflow. If all is well save it somewhere convenient. The next time you want to quit program A and launch program B use this to quit program A.

Let us know how this works. It could be done with Applescript fairly easily as well.
 
OP
B
Joined
Nov 9, 2012
Messages
5
Reaction score
0
Points
1
Hi Slydude,

In fact, those two applications are always the same. So yes, your method works. However, is it possible to automate the formula. What I would like is to be able to simply press "cmd + Q" to quit the application B and then the application A would automatically start; I would not have to modify the way I quit the aplication B.

Moreover, how could I make my small Automator application (A) to launch when the program B starts and also when it quits?

Thanks again,

Blaccko
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,609
Reaction score
1,076
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Ventura, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
I am not sure I am understanding you correctly. Here's what I think you are trying to do. For this example application A is Safari and Application B is Mail.

1. When you quit Mail using "command + Q" then Safari launches.
2. Run the Automator you created any time "Mail" is quit.

Am I understanding you correctly?
 
OP
B
Joined
Nov 9, 2012
Messages
5
Reaction score
0
Points
1
Hi,

Thanks for your reply. In fact, this is what I woudl like.

1. When I launch the Adress book, the Automator application I made runs.
2. When I quit the Adresse book (command + Q), the Automator application I made runs.

Thanks,

Blaccko
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
I think what he is saying Sly is when he quits using "cmd+q" the Automator workflow he made will kick in instead of using the Automator workflow to do what he wants.
What im thinking is he needs a Applescript to run to run the Automator workflow (when Mail quits launch Safari) when he uses "cmd+q" on mail !?!?
If that is even possible.
Sounds like he doesnt want to have to run the Workflow to quit Mail and open Safari, he wants to "cmd+q" Mail and Safari will open.

Edit: OP beat me to it
 
OP
B
Joined
Nov 9, 2012
Messages
5
Reaction score
0
Points
1
I think what he is saying Sly is when he quits using "cmd+q" the Automator workflow he made will kick in instead of using the Automator workflow to do what he wants.
What im thinking is he needs a Applescript to run to run the Automator workflow (when Mail quits launch Safari) when he uses "cmd+q" on mail !?!?
If that is even possible.
Sounds like he doesnt want to have to run the Workflow to quit Mail and open Safari, he wants to "cmd+q" Mail and Safari will open.

Edit: OP beat me to it

That's exactly it TatooedMac! Is it possible? ; )

Thanks,

Blaccko
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,609
Reaction score
1,076
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Ventura, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
Thanks guys I get it now. I am not much with Applescript but that or something like it is probably the way to go. I think it would be possible to write a script that launches Address Book (Contacts) then waits to see if that has been quit to call the Automator application you've written. I'll keep digging.

What does the application you created do btw. Just out of curiosity.
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
17,609
Reaction score
1,076
Points
113
Location
North Louisiana, USA
Your Mac's Specs
M1 MacMini 16 GB - Ventura, iPhone 14 Pro Max, 2015 iMac 16 GB Monterey
I almost have something that works. I used a preference pane called Do Something When. It allows various actions to be performed when volumes mount/unmount or when programs launch pr quit based on rules.

I was able to set a rule that runs one of my homemade Automator applications when Contacts (Address Book) launches. I set a second rule to run the same app when contacts quits. That rule does not work yet.
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
I almost have something that works. I used a preference pane called Do Something When. It allows various actions to be performed when volumes mount/unmount or when programs launch pr quit based on rules.

I was able to set a rule that runs one of my homemade Automator applications when Contacts (Address Book) launches. I set a second rule to run the same app when contacts quits. That rule does not work yet.


Sly, i had a closer look at that App Do Something When and i came up with this (see image)

so when i QUIT Mail it opens Contacts... OP you should download this App and try it out. You didnt give us specific Apps your wanting to do this with so cant try them, but i got this to work.
Also if you need a Appescript to open a Application for starters if you need try this
Code:
do shell script "open /Applications/Contacts.app"
Was trying to use this with the App from Sly but couldnt get it to run apart from launching the Applescript ..

HTH

PS Virtual Rep (need to spread it) for pointing to the App

Preference.png
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top