MacOS – Bring only one app to front after “show desktop” applied

applicationsdesktopkeyboardmacos

Consider the situation:
I have many active apps on my (main) workspace and I've taken screenshot of one of them, which was auto saved on desktop. I need to put this screenshot to another active app(e.g. mail).

To achieve this Should I go through minimizing all unneded applications one by one (there could be a dozen of them) until the desktop is seen and only target application is active and in front of workspace, so I could drag the file?

I could have use "show dektop" hot key/gesture but it hides the target app as well as others and it's not possible AFAIK to bring only it to dektop, as soon as I touch it all apps will jump back to the places they've been before "show desktop" were applied.

Would be nice if I clould bring only one app to front.

Best Answer

I use this script set up as a folder action. Basically, whenever I make a screenshot, this script activates, opening the folder I use for screenshots in the Finder, and opening the screenshot in Preview for editing. Copy it into Script Editor, save it as a script to ~/Library/Scripts/Folder Action Scripts/some_name.scpt and then use the Folder Actions Dispatcher app (available through spotlight, from down in the /System/Library/CoreServices folder) to attach the script to the desktop folder or whatever folder you prefer.

on adding folder items to this_folder after receiving these_items
    repeat with this_item in these_items
        set item_path to POSIX path of this_item
        tell application "System Events"
            set this_disk_item to disk item item_path
            tell this_disk_item
                if its name begins with "Screen Shot" and kind is "PNG Image" then
                    -- this opens the containing folder in the Finder
                    open its container
                    -- this opens the screen shot in Preview for editing
                    open it
                end if
            end tell
        end tell
    end repeat
end adding folder items to