PDA

View Full Version : Prevent a specific app from reopening on restart




haravikk
May 4, 2013, 06:10 AM
Okay, so I know how to prevent all previously open apps from being reopened on restart, but I haven't been able to find out how to prevent this only for specific apps.

You see I have an application that can't actually function properly until a specific volume is available, which usually doesn't appear straight away. So I have a script setup to detect the volume and open the application, however this doesn't help if the app was already reopened.

It's an application that I tend to leave open but hidden so I can quickly switch to it as needed, but I almost never remember to close it before shutting down.

There are various useful tricks for preventing Resume on applications (locking saved state folder and/or specific app state folders) but I haven't figured out where OS X stores the list of open applications to be reopened after restarting. Does anyone know, and if so, know of a way to prevent specific applications form being reopened? I don't mind the feature in general, so I don't want to disable it completely.



Weaselboy
May 4, 2013, 08:52 AM
Could you maybe tell your Applescript to quit the app, then mount the volume and relaunch the app?

haravikk
May 4, 2013, 09:08 AM
I could, but that doesn't prevent the application from opening with its files unavailable, which causes it to discard all cached data and to throw up its setup wizard, which is all quite disruptive.

Weaselboy
May 4, 2013, 09:17 AM
I could, but that doesn't prevent the application from opening with its files unavailable, which causes it to discard all cached data and to throw up its setup wizard, which is all quite disruptive.

Ah I see....

It looks like this is managed by a plist file at Library > Preferences > ByHost > com.apple.loginwindow.[xxxxxxxxx].plist

Not sure if you can manipulate it to do what you want though.

haravikk
May 5, 2013, 06:54 AM
It looks like this is managed by a plist file at Library > Preferences > ByHost > com.apple.loginwindow.[xxxxxxxxx].plist

Not sure if you can manipulate it to do what you want though.
Hmm, is it possible to setup a script to run on shutdown? If so then I could either close the app and see if it keeps it out of that file, or alternatively use a shut-down script to remove the app from the file, as the structure is fairly simple so it shouldn't be hard to edit.

Weaselboy
May 5, 2013, 07:48 AM
Hmm, is it possible to setup a script to run on shutdown? If so then I could either close the app and see if it keeps it out of that file, or alternatively use a shut-down script to remove the app from the file, as the structure is fairly simple so it shouldn't be hard to edit.

I use this script to shutdown. You could run a line at the start of this script to quit your app like I added here. Just put your app_name in there. That might work for you.

tell application "app_name"
quit
end tell
tell application "System Events"
tell process "Finder"
click menu item "Restart" of menu "Apple" of menu bar 1
end tell
end tell