Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Launching apps behind the lock screen?

I need to run an application behind the lock screen, e.g., just as Time Machine (and other processes) can run when the screen is locked.


Specifically, I would like to schedule an application to launch when the computer is asleep and unattended (but not powered off). The plan is to schedule wake via Energy Saver or pmset, and use iCal/Automator to schedule the app launch. The problem I'm encountering is the lock screen (ie System Pref > Security > Require Password). When the lock screen is enabled the application will not launch unattended - a user must enter the password. By way of debugging I have confirmed that disabling lock screen allows the app to launch, but this is not a solution due to the security issues.


Bottom line: Is there a way to schedule an applescript or shell script (perhaps with root privileges) to grant the lock screen access to the password? I'm thinking KeyChain should be able to do this, but I can't figure out how. Or perhaps there are other solutions?


Other details:

- I'm running 10.7 and 10.9.

Posted on Aug 9, 2015 7:06 AM

Reply
Question marked as Best reply

Posted on Aug 10, 2015 2:42 PM

I suspect you're going about this the wrong way.


AFAIK you won't be able to launch GUI-based applications in this way, but background tasks (including shell scripts) should be OK. Without more details of what it is you're trying to do/launch, it's impossible to tell.


Depending on the task, it may be better to use the system scheduling services to do this, rather than iCal/Automator

5 replies
Question marked as Best reply

Aug 10, 2015 2:42 PM in response to Underdog101

I suspect you're going about this the wrong way.


AFAIK you won't be able to launch GUI-based applications in this way, but background tasks (including shell scripts) should be OK. Without more details of what it is you're trying to do/launch, it's impossible to tell.


Depending on the task, it may be better to use the system scheduling services to do this, rather than iCal/Automator

Aug 10, 2015 3:47 PM in response to Underdog101

Apple's Daemons and Agents (TN2083) and the associated programming guide, which are the canonical references for this sort of thing. Then there's launching and (if you really need to interact with the GUI) an XPC helper.


If it's not obvious from this material, background processes interacting directly with the GUI is not something that's encouraged. The stuff that's running in the background is intentionally separated from the GUI, for reasons of security and stability.


Depending on what you're working on, Keychain has its own programming materials, as well.


Or if not and as Camelot asks, what are you up to here?

Aug 10, 2015 4:10 PM in response to Camelot

Thanks. I'm trying to schedule an overnight launch of a script that will scan files and keep the computer awake while doing so. I'd say what I'm trying to accomplish is analogous to what a scheduled antiviral scan does (or Time Machine, etc.). The script uses Applescript proper, not UI element scripting. I can launch just fine at the pre-scheduled time! I just can't do it when the lock screen is in use. If it solved the problem, I'd be open to using the shell/pmset to launch instead of ical/automator.

Aug 10, 2015 4:11 PM in response to MrHoffman

Thanks. I think my answers to Camelot would answer your questions as well:


Thanks. I'm trying to schedule an overnight launch of a script that will scan files and keep the computer awake while doing so. I'd say what I'm trying to accomplish is analogous to what a scheduled antiviral scan does (or Time Machine, etc.). The script uses Applescript proper, not UI element scripting. I can launch just fine at the pre-scheduled time! I just can't do it when the lock screen is in use. If it solved the problem, I'd be open to using the shell/pmset to launch instead of ical/automator.

Launching apps behind the lock screen?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.