Sierra & SMB & Synology NAS & Applescript crashes Finder

I've discovered a bug that I don't know how to fix. I'm able to repeat the problem. So I have an Applescript (fired via FileMaker) that tells the mac to highlight a certain file in an already opened Finder window connected to a shared folder on a Synology NAS server. This problem even happens if I run the script within the Script Editor app. Here's the Applescript:


set theFile to "West Office Files:_Scan Inbox:LAR:1002.pdf"

tell application "Finder"

reveal document file theFile

end tell


An error pops up saying the apple event doesn't understand the "reveal" message with an error code of -1708. I have also tried using "select" instead of "reveal" and the problem persists.


Then strange things begin to happen in Finder. Can't click on a finder window showing files, can't close any windows. Sometimes Finder will start popping up what I call "shadow boxes" which is the drop shadow of a window, but the window is invisible. Finder won't correct itself and the only fix I've found is to quickly log out the user to the Mac login screen and log back in. If I don't Finder will get worse and ultimately require a force restart.


This is ONLY happening with MacOS Sierra (any sub version) and when connected to a Synology NAS server (using DSM 6+) via SMB. AFP works fine, pre-Sierra Mac OSes work fine, and even when connected to an old Mac OS (Lion) Server via SMB or AFP there is no problem.


Anyone experiencing this?

iMac with Retina 5K display, macOS Sierra (10.12.5)

Posted on Jun 8, 2017 4:33 PM

Reply
1 reply

Jun 13, 2017 4:48 PM in response to TechSupport_at_CarrLaw

With help on the Stack Overflow forums I found a solution to the problem. Am posting it here to help others who use Synology NAS servers and Macs to glean info from it as well.


set theFile to POSIX file (POSIX path of "/Volumes/West Office Files/_Scan Inbox/LAR/1002.pdf") as alias

tell application "Finder"

set selection to {}

select theFile

end tell


Where the error was occurring was specifically when the AppleScript would tell the Finder to highlight a file and there was a file already highlighted. In MacOS Sierra it would throw an error in the Apple Event right when it moves away from the currently selected file. So adding in the "set selection to {}" has Finder deselect what is highlighted before selecting the next file. I also went with using POSIX for the file path by recommendation from the Stack Overflow forum.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sierra & SMB & Synology NAS & Applescript crashes Finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.