In principle, it should be possible to add either of the above keys indirectly using AppleScript. The terminal command '
defaults' can be used to modify ".plist" files, and AppleScript's "do shell script" can be used run terminal commands.
So at its most basic, as an example, try backing up your "TextEdit.app" (and quit it if it is running), then pasting this in to a "Script Editor.app" document (you must be logged in to an "admin" account):<pre>do shell script "defaults write /Applications/TextEdit.app/Contents/Info LSUIElement -string 1"
do shell script "/Applications/TextEdit.app/Contents/MacOS/TextEdit"</pre>However, it should be noted that once in a while, the '
defaults' command can cause a ".plist" file to be erased (that's why I suggested backing up "TextEdit.app" first). When this happened, it may have been when '
sudo' was used - it has happened to me a few times, but not every time, and not often enough to be able to figure out how to reproduce the bug reliably. Another factor is that sometimes, changes to the ".plist" file are not recognized by "Launch Services" so it may be necessary to include a '
lsregister' step in the script to make the change take effect (if the change was being made outside of a script, one might move the app, or duplicate it to get it to register). The '
defaults' command by default, leaves a ".plist" file with "600" permissions, whereas a typical ".plist" file has "664" or "644", and the new owner of the file will be the person running the script rather than what is probably "root" - so both "ownership" and "permissions" will have to be corrected (more steps for the script). But then again, they may not be an issue on a single-user machine...
So there are a few things to consider, depending on how thorough you want to be, but it is certainly possible.
btw, a correction is in order on my previous post - it appears that keyboard shortcuts may be effective even for an app with '
LSUIElement' set to "1" so it might be possible to quit the app using ⌘Q.