解决方法
如果可以使用AppleScript在给定的Finder窗口中获取所选文件的列表,则可以在
Cocoa应用程序中使用
Scripting Bridge与Finder进行交互.引用Apple的文档,
Scripting Bridge is a framework and a technology that makes it much easier for Cocoa developers to control and communicate with scriptable applications. Instead of incorporating AppleScript scripts in your application or dealing with the complexities of sending and handling Apple events,you can simply send Objective-C messages to an object that represents an application with a scripting interface. Your Cocoa application can do anything an AppleScript script can,but it does so in Objective-C code that is integrated with the rest of your project’s code.
没有Cocoa类代表Finder,或者更具体地说,是Finder窗口. Finder是一个应用程序,也是一个可编写脚本的应用程序,因此Scripting Bridge是最佳选择.