简体   繁体   English

如何在OSX中隐藏AppleScript运行的某些Java应用程序的Dock图标?

[英]How to hide the Dock icon of some java applications run by AppleScript in OSX?

I write some AppleScript to launch my java applications like Minecraft. 我编写了一些AppleScript来启动Minecraft之类的Java应用程序。 But there are some problems with it. 但是它有一些问题。 If I use do shell script "java -jar ~/Library/Application\\\\ Support/minecraft/launcher.jar" to launch Minecraft with AppleScript(save as app), there will be 3 icons on the dock, The AppleScript App's icon, the Minecraft Launcher's icon and the icon of Minecraft. 如果我使用do shell script "java -jar ~/Library/Application\\\\ Support/minecraft/launcher.jar"来启动带有AppleScript的Minecraft(另存为应用),则扩展坞上将有3个图标,AppleScript应用的图标, Minecraft Launcher的图标和Minecraft的图标。 How can I hide other icons except of the AppleScript Apps icon on the Dock? 如何隐藏Dock上的AppleScript Apps图标以外的其他图标?

I don't know if you can do that when activating the launcher.jar but if you tell the app to launch with "tell" you could temp hide the app, you can use the following code i wipped up 我不知道在启动launcher.jar时是否可以这样做,但是如果您告诉应用程序以“ tell”启动,则可以暂时隐藏该应用程序,您可以使用以下代码

do shell script "defaults write /Applications/Minecraft.app/Contents/Info.plist LSUIElement 1"
delay 1
tell application "Minecraft" to activate
do shell script "defaults write /Applications/Minecraft.app/Contents/Info.plist LSUIElement 0"
tell application "Minecraft" to run

As for the Main Game, I don't think you can hide that :( 至于主游戏,我认为你不能将其隐藏起来:(

(make sure minecraft is in the Application Folder) (确保minecraft在应用程序文件夹中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM