No internet connection
  1. Home
  2. How to

How to Hide Notes application

By TJ Forman @TJ_Forman
    2023-07-14 22:46:08.040Z

    Trying to get sound flow to "Hide Notes". the note taking native application on the Mac. I've successfully used two different methods on 5-7 other applications and they all work fine.

    However when I try and do what works in other application in notes, the macro doesn't work when exectuted from Stream Deck. However the macro does work if I execute it from the F6 hot key I've assigned it to.

    In the images below there are two methods I've used to hide applications

    • 1 replies
    1. Nathan Salefski @nathansalefski
        2023-07-15 01:53:52.735Z

        I actually made something today that I think would be handy for this situation:

        1. If your Notes app isn't running, it will be launched
        2. If your Notes app is running but not in the foreground, it will bring it front
        3. If your Notes app is running and in the front, it will hide it

        All with one press of a button. Easily transferrable to all your other apps

        //Define App Name
        const appName = 'Notes';
        //Define UI Element
        const isAppRunning = sf.ui.app("com.apple.Notes").mainWindow.exists
        //Determine App is Frontmost Running
        const isAppFrontmost = sf.ui.frontmostApp.uiElement['Title'] === appName;
        //Task:
        switch (true) {
            case (!isAppRunning):
                //Launch App
                sf.app.launch({path: "/System/Applications/Notes.app",});
                break
        
            case (isAppRunning && !isAppFrontmost):
                //Activate Main Window
                sf.ui.app("com.apple.Notes").appActivateMainWindow();
                break
            
            case (isAppRunning && isAppFrontmost):
                //Hide App
                sf.ui.app("com.apple.Notes").menuClick({ menuPath: ['Notes', 'Hide Notes'] });
                break
        };