Benches macOS

8

script for rebooting

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

How do I make a script to reboot my mac and when I have will I be able to simply doble click the script as an icon and have it perform the action?

8 replies

Sign in or join Beachball Help to reply.

  1. 0

    Hamper

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Niel wrote:

    Use the following AppleScript:

    tell application "System Events"

    restart

    end tell

    Save it as an application.

    (29658)

    will that just reboot my system with no confirmation from me, the user?

  2. 0

    Hamper

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Well I found one online that logs me out:

    set theMessage to "Logout of the computer?

    This will quit all applications and you will be prompted to save any unsaved documents.

    Note, please respond to any dialog prompts until the computer is completely logged out."

    display dialog theMessage giving up after 15 buttons {"Logout", "Cancel"} default button "Logout"

    if button returned of the result is "Cancel" then

    return

    else

    do shell script "touch /tmp/logoutNow"

    ignoring application responses

    tell application "loginwindow" to «event aevtrlgo»

    end ignoring

    end if

  3. 0

    spazek

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    maarut wrote:

    Maybe I'm wrong.

    Maybe! 🙂

    Seems, Hamper was looking for an application with an icon to click.

    But if he/she was looking for a
    quick way to restart, then i would suggest the shortcut:

    ctrl-cmd-eject

    Spazek

  4. 0

    Hamper

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    well what I did originally was to download a pre-made scrip from a university that logged out the user, I then gave this script and Icon (the real reason for wanting this feature at all) and then placed it on my dock - a single click to log out. But now I want a definite reboot or shut down, both (separately) but cannot fin the page the scripts were on.

  5. 0

    Niel

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Use the following AppleScript:

    tell application "System Events"

    restart

    end tell

    Save it as an application.

    (29658)

  6. 0

    smithrj

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Do you know how to use Apple Script? Or maybe a Automator work flow w/ some icon you make.

    Ray

  7. 0

    William Lloyd

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Create a text file with vi that has one line:

    sudo reboot

    Then give it +x permissions, and run it.

    🙂

  8. 0

    maarut

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Presumably you wanted a method that doesn't require input, otherwise you'd be using the Apple menu -> Restart option. Maybe I'm wrong.