Skip to main content
Question

Logout application

  • July 25, 2018
  • 1 reply
  • 4 views

Forum|alt.badge.img+15

I am working on a lab image for the university and on our windows image we have an icon on the desktop that just logs out the current user. How can I do this on the mac without admin rights? Automator? Applescripts?

1 reply

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • July 25, 2018

Try this:

#!/bin/bash

/usr/bin/osascript -e 'tell application "loginwindow" to «event aevtrlgo»'

Or just extract the Applescript line (between the single quotes) and put that into an Applescript saved as an app. This action should do an immediate logout without confirmation, meaning open unsaved work could get lost if it doesn't support auto save or resume features.

EDIT: Removed the word "event" before the applescript event call as I realized it's not needed