I've written some Thunderbird filters to be run on my Sent box. The filters process tagged messages by either deleting them or moving them to other folders, depending on the tag. The filters seem to be working the way I want them to.
Normally in Thunderbird I would have to run these filters by hand, but I figured I can use KM to make this easier. I have created a macro "Process" that runs the filters. The first thing it does is activate Thunderbird and then it activates the necessary menu items to get the job done. It works fine when I run it by hand.
Now I thought it would be nice if I could get KM to run the macro every time I switch out of Thunderbird to some other app. I have discovered the Application Trigger and have set it up to trigger whenever Thunderbird deactivates.
Unfortunately, once I set this up my Mac gets stuck in Thunderbird and I can't leave it. The only thing I can do is kill Thunderbird in order to get control back over my Mac. I believe the "Process" macro is run correctly once, but after that KM seems to wind up in an infinite loop. I'm guessing the problem has something to do with the the first action in "Process" is to activate Thunderbird. This right after the macro has just been triggered by leaving Thunderbird.
Does anybody have an ideas how I can avoid this infinite loop?
Well, yes -- as you've rightly guessed, every time you switch from Thunderbird your macro instantly activates Thunderbird again.
Why do you want it to run when you switch away from Thunderbird, delaying your switch to another application? Could you instead trigger this when you switch to Thunderbird?
Otherwise, you want to disable your macro, switch to your "new" app, then enable the macro again. So at the end of your macro add something like:
...where "Scratch" is the name of your macro -- one of the options in that dropdown is "This macro", choose that.
That should work -- if it doesn't (your Mac switches apps slower than the macro reaches the "Enable..." action) then try adding a small pause between the "Activate Last..." and "Enable Macro..." actions.
I don't know if you're familiar with MailTags and Mail Act-On, programs I've been using for a long time to manage my email using tags and reminders. Mail in Sonoma no longer allows third party extensions so I'd lose the use of this very important functionality for the way I work. That's why I've held up on installing Sonoma. The people responsible for MailTags are working on their own email program but they're still not done with it and I've basically given up on using what they will provide.
Instead I'm trying to work out a way to get the functionalities I'm looking for using Thunderbird. Since TB does not have filter processing when sending email, which is an important part of why I used MailTags, I figured I would try running the TB filters using a KM macro. My first attempt was to have this macro run every time I leave Thunderbird. My thinking was that doing this at program exit was regular enough and wouldn't interrupt anything else. Also I figured the macro would be triggered one last time when I shut my Mac down for the night.
That's what I was trying to do when I ran into the problem I reported. What I have decided to do instead is to have KM ask me every 30 minutes if I'd like to run the filters. That has worked for me up to now.
Triggering the macro when I switch to Thunderbird would be a possibility, but I liked the other way better. I figured it would be cleanest if the post-processing would happen after I was in TB and possibly changing the tags.
Thanks for your suggestion. I might try it out, but maybe not since what I've set up seems to work for me. Thanks a lot, however, for the idea of doing it that way. It's a constant learning process to find out what KM can do and how.
Gotcha. The main problem with the "run when you switch away" method is that your usually switching to another app because you want to do something -- but Thunderbird, because of its lack of Shortcuts/AS support, must be frontmost so you can drive the UI.
So the very moment you want to do something else -- you can't, because you're forced back into Thunderbird!
Triggering on program exit is a bit different in that you're expecting a pause while Thunderbird cleans up and shuts down. But it might be easier to have a macro, active only in Thunderbird, that has a hot key trigger of ⌘Q -- overriding the usual Quit command, you could take whatever actions you want and then finish the macro with a "Quit Thunderbird" action.
Add another macro trigger of ⌥⌘Q, put your "filtering" actions inside an "If Then Else" action that tests for ⌥ in %TriggerValue%, and you can can choose whether or not to run your filters when you quit Thunderbird.
And so on. Work out your ideal workflow -- there's almost certainly a way KM can help.