Script fails when Screen is is locked

I am trying to run a seemingly simple script:

Trigger at specific time
Activate OmniFocus
wait for 2 Minutes
Close OmniFocus

This works when I am logged on, but it fails after the first step when the Screen is locked:

The error message in the log file is
2015-03-18 10:20:00 Action timeout exceeded. Macro ‘Update local OmniFocus’ cancelled (while executing Activate OmniFocus 2).

I increased the timeout value for “Activate” to two Minutes, but this has no effect.
I also tried it with another application instead of OmniFocus, but the behaviour is the same.

Running KM 6.4.8 on 10.9.5

Thanks,
Guy

Many UI level things simply cannot be done when the Mac display is sleeping or screen locked.

If you want to launch (rather than “activate”) OminFocus, using the open shell command or the Open File or Folder action might work.

Hi Peter,

Is this still the case? I have a macro that logs into a website and downloads a file, but I’d like this to trigger early in the morning while the display is sleeping and the screen is locked. The macro executes perfectly when I’m logged in and manually trigger it, but it fails when running unattended.

Is there another way to do this?

Pretty much, yes. While the screen is sleeping, the system does not allow UI.

You might be able to either control Safari via AppleScript, or perhaps you could use curl, depending on how the authentication system for the web site works.

Use an AppleScript set to execute on a timer that will wake, unlock, run the KM Macro, and then sleep again.