Need help automatically hiding dock with a specific app is active



What I'm wanting to do is have the dock hide when I am using after effects. When I got to another app I want the dock to automatically show again. I am confused how to run this and would really appreciate the help. Here is screenshots of what I have, and the script I am using is

tell application "System Events"

set the autohide of the dock preferences to true

end tell

I would do it like this:

There are the two triggers: do something when “a certain app is activated” and when “a certain app is deactivated. In this section image

A shortcut can be set in mac os to show/hide the dock. In my case ⌃+4

You can use this shortcut for the two triggers (above).