Launch another application using AppleScript without showing it on the dock

Using AppleScript, you can create a script that launches another application, and then save this script itself as an application and put it in the dock. The problem (not the problem) is that when you click on it, it will still show another application on the dock. Is it possible to prevent another application from showing on the dock, but show its graphical interface, as it usually happens during execution?

thanks

+1
source share
2 answers

The only solution I can think of is to actually change the “other application” so that there is no Dock icon. This works, but it's nasty:
• Yes, you directly modify another application, and do not do something from your script.
• Accordingly, it will change every launch of the mentioned other application, and not just a call from your script.
• It prevents the use of the "OtherApp" function in the menu bar (although key combos and any controls in the window will work).

This can easily be undone, and it can almost always be done by simply adding the GUI mode flag to the Info.plist application file:

  • Right-click or press Ctrl-click for another application and select "Show Package Contents"
  • Open the Contents folder
  • Open Info.plist in your text / xml * editor
  • Add these two lines immediately after the first line that says <dict>
    <key>NSUIElement</key>
    <true/>
  • Save, then run the application. Remember & hellip; there is no menu, so make sure that one of its windows has focus and -Q to exit when you check that it works without a dock icon.

* If you neglect xml editing or if the plist file is binary, you will need a special plist editor. Apple's own property list editor is included with their free Dev Tools .

  • Add the child to the root directory ("List of Information Properties").
  • Set the name to NSUIElement .
  • In the Edit menu (or context), set the Value Type parameter to Boolean.
  • Check the ON box (sets bool to true).
+3
source

Building the previous answer - you can modify the Info.plist of your Applescript application with the same XML code. This will prevent the Applescript application from displaying (and have a menu that in my experience is unsuitable for use in this type of “application”), but your main application that you run from applescript will display as usual in the Dock.

I tried this on OSX 10.7 Lion and it worked successfully.

+2
source

Source: https://habr.com/ru/post/1341654/


All Articles