IO believe this topic is already somewhere here but I am unable to find it
Is there a script, a terminal solution, some software which will allow me not to relunch and open all the files as I start my machine?
I tried the General Option but it does nothing to me. I often work with many apps and I have no time to close them all before shutting down
Also it really annoys me to open my computer whit coworkers around able to peep my screen and see what I do
I have nothing to hide but still it annoys me tremendously
Could anyone help? Googling did not help although I tried to follow everything I found
Any help will be a blessing as already I sent this feedback to Apple and they didn’t even reply
set my_name to my name
tell application "System Events"
set visible of every process to true
delay 0.5
set proc_list to (name of every process whose visible is true and name is not "Finder" and name is not my_name)
end tell
repeat with this_proc in proc_list
tell application this_proc to quit saving no
end repeat
I don’t use the part with the ‘quit saving no’, because I like the application to ask to save changes.
Edited: also, you might need to change your System Preferences under the General pane.
Edited: also note that some apps don’t have the same name as their processes. You might need to add some checks for these apps.
Edited: I forgot. When those apps with different process names occur, the system asks you to navigate to the app.
jI’ve been meaning to fix the script for processes with different names:
set my_name to my name
tell application "System Events"
set visible of every process to true
delay 0.5
set proc_list to (displayed name of every process whose visible is true and name is not "Finder" and name is not my_name)
end tell
repeat with this_proc in proc_list
tell application this_proc to quit -- saving no
end repeat
I didn’t test it a lot and you can uncomment the ‘saving no’.
Dan, to prevent coworkers from peeping your display. I can’t see nothing but another solution than a script
I can think of more general solutions such as having your Mac not booting straight in your Account (so having the screen stuck at the Session opening dialog window). Then you’d simply open your personal session yourself. You can also have the screensaver launched after a few time and your password required straight afterwards. You can still manually delete the folder named “Saved Application State” at the end of the day. What else? Set the shutdown schedule so your Mac shuts down at the set time every day or whenever you wish. Most of these don’t require a script. Yet you can script a lot. HTH.
Model: PowerMac
Browser: Safari 536.30.1
Operating System: Mac OS X (10.8)
Save this script as an application and run it when you want to quit or restart.
In the late one, I forgot that shutdown or restart automatically saved the applications states.
This time, the script quit every open application (minus Finder and the script itself)
Then it delete the Saved Applications State datas to get rid of what was just saved or what was saved before
and at last, shutdown or restart according to your choice.
If peeping from coworkers is a problem, then you can buy a filter to put in front of your display, that renders your screen unreadable from a few feets away. Great for open office landscapes.
It’s a good idea to make time to close applications properly, especially those with open documents.
If emptying the “Saved Application State” folder actually works for the purpose in hand, an alternative approach may be simply to empty it once and then lock it. Not being able to create the “.savedState” folders in the first place doesn’t appear to have any negative effects on running applications.
Thanks Nigel.
Unfortunately my occupation is teaching film production, and also producing documentaries or short films. Therefore not onlyI need to use more than one application at the time - Often linked through scripts (mostly suggested, or even build to help from this community)-, but I might have one or two machines on. it happens that I need to move away quickly and suddenly, as something “crucial, or reported as crucial” happens.
As a professor this “Lion and post Lion” idiotic feature does not bother me so much, just as many others which changed my working ways, apps made for me and so on (I come all the way from the Still working Apple ][, back a few decades ago. But during Production time is simply impossible, especially because I cannot count on adequate support as money in this business multiplies by the thousands …
But of course you are right.
So thank you for taking care of Macscripter so well and for everyone.
Dan
Thanks Ivan however I had to change enable the part:
set maybe to name of every disk item whose name ends with “.savedState”
and perviously modify:
set p2AS to (path to library folder from user domain as text) & “Saved Application State:”
tell application “System Events” to tell folder (result & “Saved Application State”)
to
set p2AS to (path to library folder from user domain as text) & “Saved Application State:”
tell application “System Events” to tell folder (result)
else I kept getting this error:
System Events got an error: Can’t get folder “Mountain Lion:Users:danwan:Library:Saved Application State:Saved Application State”.
FInally I get to your final dialogue and the script seems to work very well
I only wonder (being a perennial incompetent if these changes may create some side effects to the whole script