简体   繁体   中英

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. 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. How can I hide other icons except of the AppleScript Apps icon on the Dock?

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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