Detect screen saver activated and safe mode

My script needs to detect if computer was booted to Safe Mode and if screensaver is currently shown in screen.

I figured out how to detect screen saver, but i still dont know how to find out if computer was booted to save mode.

To detect if the system is booted in safe mode…

It’s not a very elegant solution, but couldn’t you just find a process that doesn’t run when in safe mode but does run when normally booted? Then you could use system events or a unix solution to determine if that process is running and thus determine whether or not you’re in safe mode.

Following up on Regulus: Safe Mode (Tiger) (according to Apple)

disables all fonts other than those in /System/Library/Fonts .
moves to the Trash all font caches normally stored in /Library/Caches/com.apple.ATS/(uid)/ , where (uid) is a user ID number such as 501.
It disables all startup items and any Login Items.
you can’t use DVD Player, capture video in iMovie, use an AirPort card, use audio input or output devices, or use an internal or external USB modem.