I'm not an AppleScript Ninja but so I followed this link to automatically hide dock when it opens Unreal Engine
tell application "System Events"
set autohide of dock preferences to true
end tell
tell application "UE4Editor" to activate
But, how to disable autohide when Unreal Engine closes? I'm running this script as an App.
Is there any way I can integrate this script to Unreal Engine
app? So, I don't have to click on this app manually & everything is done for me behind the scenes automatically?
Best Answer
If you do not want to worry about creating a race condition and having to close UE4Editor before shutting down, as mentioned in the other answer, then there is a nice app called EventScripts, for $3.99 USD at the App Store, that you can use to trigger AppleScript scripts and or Shell scripts when certain events are triggered.
Here's an example AppleScript script that will hide/show the Dock when UE4Editor launches/quits:
In Script Editor, save the above AppleScript code as, e.g., UE4Editor - On Open and Close.scpt in ~/Library/Application Scripts/net.mousedown.EventScripts/, (after EventScripts is installed).
Now in EventScripts, add the same script twice, while setting the Event for one to Application launched and the other to Application quit.
Now, when UE4Editor launches, the Dock is hidden, and when UE4Editor quits the Dock is unhidden.
EventScripts has a long list of events it can trigger a script on. Check out the links below for more information:
Note: I'm not affiliated with the developer of EventScripts, just a satisfied customer.