My First AppleScript (14th December 2010)

This starts BBC 6 Music in Safari after the Mac G5 test machine has started up. It sizes and hides the window.

tell application "Safari"
        open location ""
        set the bounds of the first window to {20,350, 415,990} // top left corner, bottom right corner
        tell application "System Events"
                set visible of process "Safari" to false
        end tell
end tell

The syntax is emminently readable but hardly intuitive. The line which says set visible of process "Safari" to false simply does what the GUI calls Hide Safari. For my first attempt at that line, I simple wrote hide safari but that was invalid.

Also, that statement only works when it’s nested within a tell application directed at the magic strict System Events. You aren’t telling Safari to Hide itself, you are telling the operating system’s event model to change a property it is storing about Safari, which then leads to Safari being hidden, from what I can gather.

Such implementation details aren’t helpful in a scripting language which appears to attempt a low barrier to entry. It succeeds for the most part and lots of copy-and-paste AppleScript code is easily found on the web.