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?

2 Answers 2


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:

on run eventArgs
    set theAppName to applicationName in eventArgs
    set theTrigger to trigger in eventArgs
    if theTrigger is "Application launched" and theAppName is "UE4Editor" then
    else if theTrigger is "Application quit" and theAppName is "UE4Editor" then
    end if
end run

on hideDock(b)
    tell application "System Events"
        set autohide of dock preferences to b
    end tell
end hideDock

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.


This depends on whether UE4Editor will launch from shell script, so I cannot test it... it works fine with TextEdit.

Save this as a standalone app, rather than a script. It should work as either, but an app is tidier.

tell application "System Events" to set autohide of dock preferences to true
tell current application to do shell script "/Applications/UE4Editor.app/Contents/MacOS/UE4Editor"  
tell application "System Events" to set autohide of dock preferences to false

As you are launching from shell script, the script app will hide the Dock, launch your editor, then simply wait until the UE4Editor quits, then continue from where it left off, hiding the Dock. It will then quit itself.
This does mean that it will look like it went Not Responding for the duration of your session, but that actually causes no issues in itself. I have script apps like this that sit open for a week or more & do no harm at all.

Note: If you reboot the Mac whilst this is running, the Mac itself will restore your last Editor session & therefore will be in a race condition with the script. Make sure to quit the editor before shutting down or rebooting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .