After using MacOsX Lion for a while, one of the most annoying “features” for me is the saved state, where apps are automatically launched after resetting or shutting down your Mac.
The idea is pretty good, but the annoyance comes when you have to uncheck a little box each and every time you turn off or restart your Mac in order to disable it.
After digging around the defaults configuration, I found the following string:
TALLogoutSavesState = 1
According to my common sense, changing that 1 for a 0 should disable the function. It actually worked, but the configuration was lost after each reboot, meaning that you had to go into terminal and write the “0″ into that string every time you wanted to restart or shut down your computer. At the end, I was easier to uncheck the little box.
However, I built a small applescript that will write the 0 for you, and then turn off your Mac, and all this with just one simple click on the icon of the app.
As it came very handy to me, I decided to share it online. So please feel free to download it, report any bugs or comments on this post, and share with your friends!
GUI Scripting Version (Somewhat Cleaner)
Note: To fix the “Access to assistive devices disabled.” error follow these simple steps:
Go into System Preferences -> Universal Access -> Check box at bottom for “Enable Access for assistive Devices”.
After that, manually log out or reboot your system for changes to take effect. (Thanks Mccleodx for pointing this out!)
- Increased delay time to fix “Can’t get windSow 1…” error.
- Script now compatible with any language.
- Changed working method. Instead of editing the defaults of “TALLogoutSavesState”, the application now interacts with Finder as if it was the user clicking the checkbox and then clicking the Shut Down option.
- Initial Release
Shell Script Version (Use if GUI version conflicts with your system)
Download Shell Version
- Uses Shell Scripting instead of GUI Scripting