Any App: Hide

This minimizes the stated app. Useful for when Automator puts and app that it’s using onscreen and you’d rather not see it. This scriptlet is for iPhoto. You can change the word iTunes to iPhoto, or whatever app you want to hide, provided it has the Apple-H shortcut. Make sure your app name is in quotes. (Requires UI scripting enabled.)

--Hide App
tell app "System Events"
tell app "iTunes" to activate
tell process "iTunes" to keystroke "h" using command down
end tell
end tell