Page 1 of 1

Sandbox friendly version of this check

Posted: Sun Nov 25, 2012 4:24 pm
by doobox
Hi there,

I have just made this to test if another application is currently running.
But i am pretty sure this is not sandbox friendly, and will get a rejection.
Can anyone think of a way to test if another app is currently running that will be sandbox friendly.
I think accessing system events is a no no, right..?

Code: Select all

// Check if Another application is running
function isApplicationRunning pTheApplication -- where pTheApplication is the name of the application
   do "tell application" && quote & "System Events" & quote & cr \
         & "count (every process whose name is" && quote & pTheApplication & quote & ")" & cr \
         & "end tell" as applescript
   return the result -- greater than 0 if running, 0 if not
end isApplicationRunning

Re: Sandbox friendly version of this check

Posted: Tue Dec 04, 2012 3:41 pm
by Mark
Hi Gary,

it looks like you need an external if you want to do this in a really sandbox-friendly way but it should also be possible to set a temporary exception entitlement that allows you to retrieve information from e.g. Finder or System Events using AppleScript.

With App Sandbox, you can receive Apple events and respond to Apple events, but you cannot send Apple events to arbitrary apps. By using a temporary exception entitlement, you can enable the sending of Apple events to a list of specific apps that you specify.

More info at http://qery.us/3b8.

Kind regards,

Mark

Re: Sandbox friendly version of this check

Posted: Sun Aug 24, 2014 11:31 am
by Mag
Hi Mark,

the URL you posted no longer works. Is this the page you refer to?

https://developer.apple.com/library/mac ... 95-CH5-SW3

Re: Sandbox friendly version of this check

Posted: Sun Aug 24, 2014 10:03 pm
by Mark
Hi,

It looks like it was this website http://qery.us/cdu but Apple made some changes and the original text is no longer there as far as I can see.

Kind regards,

Mark

Re: Sandbox friendly version of this check

Posted: Wed Aug 27, 2014 12:47 am
by Mag
Thank you Mark