Using temporary entitlements is a hit and miss situation. Especially with Apple Script, Apple do allow Apple Script entitlements, providing that they cannot be used with malicious intent. So scripting the Finder is out of the question as it could potentially allow the Sandboxed application access to the entire users file system and negates the Sandbox.
Yet some companies (mainly the bigger ones), even have TEs that allow the app full access to the file system. So it can be done, but what’s the secret, I guess probably money…
I know that RS has built-in objects for working with Microsoft apps, if you’re targeting these specific apps then maybe these will work?
[quote=8832:@Sam Rowlands] So scripting the Finder is out of the question as it could potentially allow the Sandboxed application access to the entire users file system and negates the Sandbox.[/quote]The following script works in Sandbox mode, when I’m adding com.apple.finder to ‘Apple Events & Specific Files’ section of AppWrapper (when the template is found in the container):
tell application "Finder"
set myPath to ((path to home folder) as text) & "Documents:Seminar Pro:templates:imLabels.dotm"
set thePath to a reference to alias myPath
open thePath as alias
But if I understand right, then I have to avoid any call to Finder, otherwise the app will most likely not be accepted on MAS. I can work around this by working directly with specific apps like MS Word (by adding com.microsoft.Word in AppWrapper, etc). I do something like this:
tell application "Microsoft Word"
if length of param1 > 0 then
open (path to home folder as string) & "Documents:Seminar Pro:templates:" & param1
[quote=8832:@Sam Rowlands]I know that RS has built-in objects for working with Microsoft apps, if you’re targeting these specific apps then maybe these will work?[/quote]AFAIK, they are Windows only. I do not see any other way than using AppleScript to control Office Apps on OSX. And Apple seems to discourage us from using AppleScript. How else would we then make use of existing solutions? For the sake of ‘security’, do we have to reinvent the wheel now again and again, like coding a WordProcessor and SpreadSheet into each and every app?!
Indeed - thats how it seems. I tried to get Apple to give a definitive guide to using TEs, like under what circumstances, but the Apple engineer said it’s taken on a case by case situation, except for the Finder where it’s off limits. (As far as MAS is concerned).
Which is part of the reason that App Wrapper is not available on the Mac App Store
I didn’t know if they were for Windows or not as I’ve never used them.
Does your app bundle contain the templates? If so you might be able to request NSWorkSpace to open the template in Word for you.
NSWorkSpace, that was the missing link. Thanks for the hint! That is what I was hoping for, when I initially posted on this thread.
And yes, I do have some sample templates in my app, which get called from a XojoScript. Using NSWorkSpaceMBS, I will probably be able to add a function to XojoScript so that a user can call his own, selfmade templates.
Something in this example’s direction will probably do it for me (found at Monkeybread’s):
[code]dim f as FolderItem
if NSWorkspaceMBS.openFile(f,“BBEdit”) then
It should do, we use NSWorkSpace to allow our users to select an application when they export photos from our application.
I use the NSSavePanelMBS functions to inject an accessoryView into the SavePanel, where I allow users to select the application (take a look at “Shine” on my site for an example). Then once the exported image has been generated, I call NSWorkSpace to open the image into the chosen application.
I’ve seen on the Apple forums, people moaning that this function doesn’t work for them, so it may have something to do showing the SavePanel first, I don’t know.
Unfortunately it looks very likely that you might get rejected for it, at least this poor soul did at stackoverflow .
A pattern emerges… Your placing the file within a location where your application has access to the file (just like when I used the save dialog). So maybe this people complaining are not using files that they have access too?