There are dozens of hints that programatically toggle the Dock's auto-hide state. Some suggest modifying com.apple.Dock, then killing the dock. Others rely on sending keystrokes to merely toggle the dock state.
Neither of these give the user elegant control over the state of the dock. So, I've written a small snippet of AppleScript combining these ideas, giving absolute control over the Dock's hiding state without killing the dock or modifying the plist. This is suitable for use in any situation where you want to allow the user to control the Dock's visibility state in your AppleScript code:
set weWantToHideTheDock to true set currentDockHiddenState to (do shell script "defaults read com.apple.Dock autohide") if (currentDockHiddenState is equal to "0") and (weWantToHideTheDock) then tell application "System Events" keystroke "d" using [command down, option down] end tell else if (weWantToHideTheDock is false) and (currentDockHiddenState is equal to "1") then tell application "System Events" keystroke "d" using [command down, option down] end tell end if end if
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100316164551355