Is there a way to show a palette only when a group of applications is running? I have a palette with macros specific for working with three apps together and would like to show the palette only when they are all running. Sorry if I am missing something obvious!
Wouldn't a Macro Group matching your needs work? Then add the specific macros (with or without palettes) to the group. Like so:
I thought her requirement was that the macro which starts the palette should run only when ALL the apps are running, but your solution is for when ANY of them is active.
If I'm right, she can still do it, but she has to add an IF statement and manually check if the required apps are all running before activating the palette.
I misunderstood how the Macro Group requirements would behave, thinking it would be active when the selected apps were active. But you're correct, that macros in such a group as presented will run if any of the apps are active.
Right. I am looking to show the palette only when a combination of three applications are running. I'm unclear where I set the conditional up. Would I then set up a global macro that runs when any of the apps activates and then checks for the other two, and toggles the palette?
App activation can be used as a trigger, but what you just said is different from your original requirement. In your original message you said you wanted the palette to run only when a set of apps is active. Now you are saying that you want the trigger to be the launch of one of the apps. Anything is possible, but I can't give you a solution until I know what you want.
Based on your last post, I think you are saying that you want the palette to run when the final app (from your set of apps) is launched (you said "activated", but I think you meant "launched." But again, I'm not sure.) Is that right? I'm not sure what the purpose of that would be. Can you explain why you want that, or tell me if I'm wrong about what you want?
If you can clarify what you are trying to do, I'd be happy to try to help you.
P.S. When I saw your name, I thought it said "Chrissi" and so I think I used the wrong pronoun to address you. Sorry about that. I don't want to go to jail.
Depending on the use case. If you want the palette to show whenever any one of the apps activates and the other are running, something like this should work:
I agree that should work, and it's clear, but it is possible to trim down the amount of code, perhaps by starting with this action: (with the app names in the text box)
I think I've whittled the entire macro down to a fixed 4 actions, regardless of how many apps need to be tested.
Interesting. I see only one action.
EDIT:
Ugh. This is much simpler, if you don't need/want to mess with any variables.
Hello Airy (@Airy) & Evan (@evanfuchs)
Since the OP wants the Palette displayed when one of his Apps is frontmost but the others must be running in the background I suggest this approach:
-
If - Action with 2 Conditions
-
Text
%ForegroundApplications%
%Application%Foreground%
containsFinder, Mail, Messages
-
Text
%Application%1%
matches^(Finder|Mail|Messages)$
-
I think this might solve also potentially issues where an App would have to be remapped to the Macro since I don’t use the Application condition at all.
Greetings from Germany
Tobias
I've never seen %ForegroundApplications%
. Although it works as you described, when I put it in a Display Text action, it just shows "%ForegroundApplications%" as opposed to %Application%Foreground%
which lists all foreground apps.
Hey Evan
Thanks for pointing me on my mistake… I knew I made a mistake in my suggestion. And again I wrote the dedicated Token wrong.
(Thinking about a correction Expansion to never letting that happen again)
Anyway I’m glad I was able to help out with my solution.
Greetings from Germany
Tobias
Yes, I showed you one action just to give insight on how my macro handles multiple apps in a single action. As you can see, I'm specifying all the apps by name in a text box. The action inside that loop sets a local variable to 1 if that app isn't running. Then the action after that app opens the palette if the variable is not 1. It's quite amazing. The whole approach takes only 4 actions in total.
Your approach looks very good, but it does require listing all the apps twice, while my solution requires listing them only once. In addition, I think the first of your two conditions appears to require listing each app in a separate expression. But I'm not sure since you didn't display your code.
The main issue here is that I'm not sure what he wants as the trigger. He may want some sort of automated trigger, or he may want a hotkey. Depending on what he wants, our code may not be sufficient.
Hello Airy (@Airy)
I understand the OP‘s request as that he wants the Palette to be displayed/displayable if all desired Applications are running and 1 of them must be the Frontmost.
For this kind of Setup it’s absolutely not necessary which trigger is used since it
- only works if all desired Applications are running
- One of the desired ones is at front
It’s based on an AND type of Validation, which I have in use for many of my Macro Palettes and Macros in General (at least 1000 times or more).
It also is a definitely solid once set -and forget approach since its Text based and not linked to these Apps what can cause broken links …
Besides that - How would your Macro know that it has to handle Applications if you don’t use Application - Based Tokens?! Without Scripts it becomes an entire impossible thing.
Greetings from Germany
Tobias
Great point! I didn't catch what you meant by this earlier, but you're right that updates and new versions of an app can break the link in the dropdown menu. I've noticed this even when the title of the app doesn't change. Smart.
Oh ye of little faith. I already have a working macro that works without tokens. I use a different method, but get the same result as tokens. I haven't uploaded my entire method because I asked the OP about how he wants the macro triggered, and he hasn't responded.
As I said, your method is fine too, although your method a little more verbose as it requires multiple occurrences of the app names.
Hello Evan (@evanfuchs)
Thanks appreciate it.
Besides that you can also use AppleScript or JXA to Script every Action that is linking specific Applications. It’s also something I just discovered recently that works well to protect you from broken Links.
Greetings from Germany
Tobias
Hey Airy (@Airy)
This sounds very interesting… I am wondering how you dit that …
Would be interesting to see your Token-Less Solution. Maybe share it anyway?!
Greetings from Germany
Tobias
I may not be following this, but it seems to me the events to watch to are "launch" and "quit". Don't you want to check the entire "is running list" whenever one of these occur?
So the macro will need to have a launch and quit trigger for each app.
Since we can't can tell whether the event that triggered the macro was a launch or quit--unless we create a separate macro for launches or quits--we'll need to check the entire list to know if the list is now complete or missing an app.
FWIW, this is the token info for TextEdit when it either quits or launches.
TriggerBase: Application Trigger
TriggerValue: /Applications/TextEdit.app