Logout dialog/ log out prompt

Discussion in 'Mac Programming' started by mzelmano, Apr 23, 2012.

  1. mzelmano macrumors newbie

    Apr 23, 2012
    Hi All,

    I was wondering if somebody could help me. I would like to run a script when a user selects log out from the apple drop down to ask the user if they backed up their data before it allows them to log out. I created a script that prompts you and then brings you to the logout screen but do not know how to get it to run, or something similar to run, when you select log out. Obviously, I do not want it to run when the user has already logged out..

    The other option I see that could work would be to change the message, "are you sure you want to quit all applications and log out now?" which I cannot figure out how to do.

    Any help would be greatly appreciated

  2. gnasher729 macrumors P6


    Nov 25, 2005
    As a user, I would shoot anyone who messed around with my Mac on that level. There are some excellent mechanisms in Cocoa that allow an application to save the user's work either automatically or manually, or refuse to quit, and that works just fine, so what you are trying to achieve is most unfriendly to the user and totally unnecessary.
  3. mzelmano thread starter macrumors newbie

    Apr 23, 2012

    By the way, the script so far is:
    tell application "Finder" to display dialog "Please Backup Your Data

    There is a risk of data loss if the machine experiences a hardware failure or an accident occurs" buttons {"Log Out", "Cancel"} default button "Cancel" with icon stop

    if button returned of result is "Log Out" then
    tell application "System Events"
    log out
    end tell
    end if

    The reason I need this script is because Users were storing files locally on a school machine and when the machines are re-imaged or incase of hardware failure we want to make sure that the student remembered to backup their data to their external hard drive.

    We will not be erasing any content, we just wanted to remind students to backup every time they log out of their account


Share This Page