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, 2017 at 22:00
1 Answer
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' '[email protected]'"
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' '[email protected]'"
end opening folder