Quinn;
Thanks for your reply.
Yeah Numbers works somewhat better but there are issues….
First I don’t have any need for the actual file to be returned via AppleScript.
I cannot predict how large a given file might be…
So using Numbers file property of the document object, if I return only the POSIX path of the file object - I do get different behavior than with the returned path string from TextEdit..
My app takes the AppleScript result and constructs a custom attributedString that embeds the fileURL…
When the user clicks on this attributedString (from Numbers) in the app’s main textView, I don’t get the error:
[sandbox] Sandbox extension creation failed: client lacks entitlements? for path:
Instead a Finder view opens to the enclosing folder without any complaining in the console - better yes, but not what I expect! I expected the file to actually open…
But this ‘enclosing folder’ behavior is something I observe with a number of different ‘click on link’ actions - it seems that the ’System’ is forcing the user to perform the specific action to open a file rather that performing that open when the user only implies ‘open that file’…
The user can build a collection of these text selection actions - the main attributes are stored in a custom CoreData repo.
The use of CoreData is another reason why returning the file is not the correct result - I don’t want to store randomly large files in CoreData when all I want is a fileURL….
When I quit and relaunch the app, clicking on the attributedString results in the same Finder behavior but now the error mention above is shown in the Console.
So the sandbox permission is very short lived - it only lasts for the current session….
From my perspective this is a limitation of the sandbox - If the user correctly asked me to access a file - why does that permission not persist if none of the security constraints have changed?
Sure I do understand that there are issues - but I am trying to articulate the limitations I experience in app development…
So the whole POSIX thing above let to experimentation with the AppleScript in TextEdit.
On the whole I don’t find a better solution than simply returning the path string and using it in the attributedString mentioned above.
In this case, the click action will throw this error to the console but will also open the enclosing folder as above.
The user’s experience is identical to what happens with the file object from the Numbers script….