Is there a way for an application to tell if desktop files/folders are selected in the Finder?
Several apps can do that so it should be possible in Xojo, too. At first glance, I wasn’t able to find anything for NSFileManagerMBS. AppleScript should work, too. See Posix path of Finder selection query... - AppleScript | Mac OS X - MacScripter .
A cheap way to do it via a Shell:
var finderSelection as new Shell finderSelection.Execute( _ "/usr/bin/osascript", _ "-e 'if running of application ""Finder"" then tell application ""Finder"" to selection'" _ ) if finderSelection.Result.Trim <> "" then // There is a selection MessageBox finderSelection.Result.Trim end if
Thanks Beatrix and Kem! I was able to combine both of your methods to get a list of selected file/folders, and then removed the ones that weren’t on the Desktop.