0

I wanna control 'Finder' in my app, so I can minimize Finder. I tried ScriptingBridge, but it doesn't work in Sanboxed. But it works when the app is not sandboxed. So I check the Apple's developer documents, seems that I have to set com.apple.security.scripting-targets in entitlements when I need to use ScriptingBridge in sandbox. But it doesn't say anything about the setting, so what should I do in the setting in order to control finder? Thanks in advance.

here is entitlements : com.apple.security.scripting-targets ??????? ????

2 Answers2

2

Finder does not have any scripting access groups. You could add the temporary exception com.apple.security.temporary-exception.apple-events as documented here.

To find scripting targets see here: How can I know the Apple Event Access Groups used by an application?

If you'd like to distribute your app in App Store, however, you're out of luck. By scripting Finder, your app will not pass the review into the App Store.

Community
  • 1
  • 1
mahal tertin
  • 3,239
  • 24
  • 41
0

Finder does not have any scripting access groups on purpose, because it lets you dodge sandbox file system restrictions. (As the other answer mentions, you could use the old temporary-exception.apple-events entitlement to script Finder anyway, but it won't pass store review.) Try using NSWorkspace instead, in particular the -openFile, -launchApplication, and -selectFile methods. If by "minimize" you really meant "hide", then see -[NSRunningApplication hide].

Chris N
  • 905
  • 5
  • 10