kostyafarber Posted October 16, 2022 Share Posted October 16, 2022 Hi all, Is there a simple way to check if an application is open before executing a part of a workflow? I'm working on a workflow where at a certain point I have to introduce a delay. This is only necessary when the app is closed. However if the app is open then we don't need the delay. Is there any way to do this natively in Alfred or do I have to incorporate this into my code somehow? Thanks! Link to comment
Stephen_C Posted October 16, 2022 Share Posted October 16, 2022 Assuming you're using Alfred 5, take a look at Automation Tasks—which include (under macOS) Is App Running?. Stephen Link to comment
kostyafarber Posted October 16, 2022 Author Share Posted October 16, 2022 Hey this is close. I think I wasn't clear enough. Is there any way to check if the app window is open. (i.e the app could be open but have it's window closed). I'd only want to run this branch if the window was open. Link to comment
vitor Posted October 17, 2022 Share Posted October 17, 2022 This won’t work for every app, but if you have a Run Script Action with Language set to /usr/bin/osascript (JavaScript) and code Application("Safari").windows().length > 0 (replace Safari with the app’s name), it should give the result you want. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now