Applescript to kill open applications and log out user after 30 min. of inactivity
Have you tried using the built in tools to force a log out upon reaching a certain idle time?



It is an Advanced Option (see the bottom button) in the Security &amp; Privacy preference pane on Lion.

If you want one user to have a different timeout you can script things easily with Automator or AppleScript:

tell application "System Events"
    log out
end tell


The trick is making your custom app keep a timer for 30 minutes of inactivity which is why the system control panel is the best option for this request.