screencapture script strangeness

I have an applescript that calls for a "do shell script “/usr/sbin/screencapture " & filename”

this script runs in its entirety when run manually and generates a nice screencap. However, when called by cronix, it generates an image file that is perfectly black. Anyone know why this would be?

is there some sort of change from 10.4 to 10.5 that would make it so that the screencapture command cannot effectively be called from cron?

again, if I run the script manually, it executes perfectly. When cron calls for it, the script executes fine, but the screencapture is simply a black image.

Please help.

Something has changed.

For a variety of reasons, I have always had cron execute from a script. This has worked flawlessly for sometime.

However, in 10.5, it appears that in order for screencapture to work properly, it has to be called “in the same mach bootstrap hierarchy as loginwindow”

So, there are two ways around that - you could identify the process id for loginwindow and tell screencapture to run within the same process id. But, you need to run that script using “sudo,” and since this is supposed to be automated and requiring no user interface, that is problematic.

However, if you save the script as an application, and have cron open the application, that step happens within the same bootstrap hierarchy as loginwindow and the script step works perfectly. Problem solved. :slight_smile: