Last active
January 18, 2023 21:54
-
-
Save SKaplanOfficial/b6d5d4a95aa13f645c77d62e5868d1b1 to your computer and use it in GitHub Desktop.
PyXA script to run a Flow session only when a specific application (Notes) is open. Session stops when Notes is closed and restarts if the app is opened again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyXA # Version 0.2.0 | |
from time import sleep | |
flow = PyXA.Application("Flow") | |
in_session = False | |
while True: | |
apps = PyXA.running_applications().localized_name() | |
if "Notes" in apps and not in_session: | |
flow.start() | |
in_session = True | |
elif "Notes" not in apps: | |
flow.stop() | |
in_session = False | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment