Automatic login ...

I think the idletime shell script can be shorter:

on idle
	set idletime to do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000);exit}'"
	if idletime > 900 then
		do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 508"
	end if
	return 60
end idle

I still think the pure shell script method using launchd is best.

Hi cwtnospam,

I understand … but I am really not a pro scripter, and obviously know nothing of shellscripting. Maybe someday I will have the time to give a deeper try.

When my computer is inactive for a long period (assuming that I have left …), I need to execute 5 routine tasks. I think that having one script to check the inactivity is better and simpler than having multiple scripts to do it. Before putting my computer to sleep, I want to:

¢ desactivate a printer driver that crashes the Finder (and for which HP as no new printer driver until I change my printer)
¢ sync my data with MobileMe
¢ do I incremental backup to my iDisk
¢ permutate my AdminUser to a NonAdminAndNonPaswordedUser (the reason for your original shellscript)
¢ at last, put the computer to sleep

Regards.

Robert

Hi cwtnospam,

What would be the line code to switch from a user to the open session window ? Thanks in advance.

Robert