Logout Script HELP!!!

Discussion in 'macOS' started by apenaroks, Jul 30, 2008.

  1. apenaroks macrumors member

    Joined:
    Jun 21, 2008
    #1
    Im trying to make a script for guests on Leopard that will tell them the Terms of Use on the Mac, this is what I have so far,

    display dialog "Welcome to Mac OS X! Please remember that this computer is property of Andres Pena and IS NOT warantied. Any physical or software damage done to the computer will be charged to the person (s) will be charged for damage. So save your self the hassle, and don't ruin my Mac. Any and all applications that you wish to install must be approved by Andres Pena first. Any software updates are by me, so please don't do software update, I manage the updates. Plugins such as Flip4Mac are there for you to be able to view different types of media on the internet. Fell free to install any all internet plugins to help you enjoy a better internet experience. All dashboard widgets are there for you, all features of 10.5.4 are there for you to enjoy!

    By clicking Accept, you agree to the Terms of Service. Otherwise, click deny" buttons {"Accept", "Deny"} default button "Accept"

    if answer is "Deny" then
    Logout
    end if




    But when i try to use the "Deny" command, it wont lout out. It says that the variable answer is not defined. How do I get it to log the user out?
     
  2. theyellowdart macrumors regular

    Joined:
    Jul 29, 2008
    Location:
    The Mitten State
    #2
    change logout to be

    do shell script "logout"

    See if that works. (Assuming this is applescript, not to familiar with it. more of a bash/perl guy myself)
     
  3. apenaroks thread starter macrumors member

    Joined:
    Jun 21, 2008
    #3
    Nope, the variable answer is still not defined
     
  4. theyellowdart macrumors regular

    Joined:
    Jul 29, 2008
    Location:
    The Mitten State
    #4
    Ohhh I didn't read your post right haha.

    Answer is never being defined (if answer is deny). You have to set answer to equal whatever button they press.

    I don't have the applescript knowledge to help you there.
     
  5. apenaroks thread starter macrumors member

    Joined:
    Jun 21, 2008
    #5
    Ok, i went through my recent notes for apple script and before the "if" command, i put "set answer to button returned of the result" which defines answer.

    the "do shell script "Logout" gives me:
    sh: line 0: logout: not login shell: use `exit'
     
  6. theyellowdart macrumors regular

    Joined:
    Jul 29, 2008
    Location:
    The Mitten State
    #6
    Yea, that was my fault again. Maybe you should stop taking advice from me ;)

    Change it back to regular "Logout" see if that works (I don't think it will.. but it may) I'm gonna go searching for how to logout via applescript.

    EDIT: Found this, might want to try it:
    tell application "System Events" to log out
     

Share This Page