Hi Is there a way to check if a file at a specified URL is open and being edited by another application. Assuming that we have permission to access the file at the URL.
OK, that’s a very different problem specification than the one you lead with. But it’s perfectly doable, by running an AppleScript within your app. There are a variety of ways to do that, but my go-to choice is NSAppleScript
.
And, yeah, doing this from a sandboxed app might not be possible [1] and, even if it were, it’d require such temporary exception entitlements as to make App Store distribution infeasible.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] The issue is that the temporary exception entitlement in question, com.apple.security.temporary-exception.apple-events
, doesn’t support wild cards, so you can’t use it to allow scripting all applications.
You could use a non-sandboxed helper — something I discuss The Case for Sandboxing a Directly Distributed App — but that’s a bunch of extra code for very limited gain.