Prevent a specific app from reopening on restart

Discussion in 'OS X Mountain Lion (10.8)' started by haravikk, May 4, 2013.

  1. macrumors 65816

    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.
  2. macrumors demi-god


    Could you maybe tell your Applescript to quit the app, then mount the volume and relaunch the app?
  3. macrumors 65816

    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.
  4. macrumors demi-god


    Ah I see....

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

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

    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.
  6. macrumors demi-god


    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"
    end tell
    tell application "System Events"
    	tell process "Finder"
    		click menu item "Restart" of menu "Apple" of menu bar 1
    	end tell
    end tell

Share This Page