How to disable autohide dock autohide when the app closes 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 &amp; everything is done for me behind the scenes automatically?
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
        hideDock(true)
    else if theTrigger is "Application quit" and theAppName is "UE4Editor" then
        hideDock(false)
    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:


EventScripts - Developers Website
EventScripts - Mac App Store Preview
EventScripts - Available Events and Parameters
EventScripts - Example Scripts


Note: I'm not affiliated with the developer of EventScripts, just a satisfied customer.