Skip to content

AppleScript to resize Safari for recording a YouTube HD video

Occasionally I need to produce YouTube HD videos showing me doing something in a web browser. Up ’till now I’ve had to painfully, manually resize the browser window to 1280×720 so that the video didn’t get unnaturally shrunk or expanded by my screencast rendering software. Tonight I figured out a way to automatically resize my browser window to the exact dimensions using AppleScript.

Here is the magical incantation:

tell application “Safari”

activate
set the bounds of the first window to {0, 0, 1280, 720}

end tell

Run this application in AppleScript Editor (/Applications/Utilities/AppleScript Editor) and your browser will be the perfect size for recording movies. You can save the script to a folder for later reuse.

{ 1 } Comments

  1. Patrick Mueller | 1 March, 2010 at 10:49 am | Permalink

    Good excuse to give github a try; I’ve saved this as a gist: http://gist.github.com/318468 ; one reason to do it as a gist instead of inline in your blog entry is that your blog software converted the double quotes to “smart quotes”. urghhhh ….

Post a Comment

Your email is never published nor shared. Required fields are marked *