I am really in need of a way to find out what window Finder is looking at so for example, if the user opens a certain folder I can get a notification. Is this possible?

  • 1
    @Mateusz I’ve edited the question to be specific to that, thanks for your input. Leon, feel free to edit your question to be specific to the problem you are facing and take a look at the linked duplicate for your original problem stated in the title. – grg Jul 26 '17 at 22:00

Create an AppleScript file with the content

on opening folder theAttachedFolder

    do shell script "echo 'The folder \"folder name\" has been opened' | mail -s 'folder opened' 'name@sld.tld'"

end opening folder

replace folder name in \"folder name\" with the real folder name, enter a proper email address in the .scpt file and save it to /Library/Scripts/Folder\ Action\ Scripts.

Then configure a folder action with this script by attaching it to the monitored folder. If mail ... doesn't work in your environment you have to use another CLI mail client. With a working OS X/macOS Server and its configured and running mail server and respective user accounts it works right out of the box.

More advanced version which requires to insert an email address only:

on opening folder theAttachedFolder

    set theFolder to quoted form of POSIX path of theAttachedFolder
    set Username to quoted form of short user name of (system info)

    do shell script "echo 'The folder " & theFolder & " has been opened by " & Username & "!' | mail -s 'Monitored folder opened' 'name@sld.tld'"

end opening folder

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .