Archive for the ‘S.A.S.Q.’ Category

AppleScript Code for Converting an AVI to an MP4 in QuickTime Pro

Monday, November 19th, 2007

Anther Simple Answer to a Specific Quesion:

As part of my ongoing obsession with converting and storing video on the Mac, one of the obvious tools I’ve looked at for converting from .avi files .mp4 files QuickTime. Assuming you can get your video to play (hint: http://www.divx.com/), Quicktime Pro has an Export feature that produces very acceptable video using the H.264 codec.

Since there didn’t seem to be any mechanism for batch processing, I looked into using Applescript to automate the task. I found numerous examples online that almost did what I needed, but nothing that was exactly right. In every case, the format was wrong, and the script in question did way more than I wanted. So here’s the bare bones, stripped down AppleScript code for…

…saving MPEG4 export settings to an external file:

tell app "QuickTime Player"
    tell first movie
        save export settings for MPEG4 to file "Users:yourname:MPEG4 Settings"
    end tell
end tell

…and converting an .avi file to an .mp4 using a saved external settings file:

tell application "QuickTime Player"
    activate
    close every window
end tell
tell application "QuickTime Player"
    open "Data:Upload:Harvey Birdman - 4x02 - Incredible Hippo.avi"
    if (can export front movie as MPEG4) then
        set theTime to duration of front movie
        with timeout of theTime seconds
            export front movie to ("Data:Upload:Harvey Birdman - 4x02 - Incredible Hippo.mp4") as MPEG4 using settings file "Users:yourname:MPEG4 Settings"
        end timeout
    end if
end tell
quit application "Quicktime Player"

How to set a value as “Primary” in the Mac Address Book

Monday, October 22nd, 2007

Another Simple Answer to a Specific Question:

As of OS X 10.4.10, at least, the Mac Address has the concept of “Primary” email addresses, phone numbers and street addresses for each contact, but you cannot change them unless you install a plug-in.

Fixing a PHP CLI segmentation fault

Monday, September 17th, 2007

Another Short Answer to a Specific Question:

Sometimes, after an upgrade, any PHP script run from the command line causes a segmentation fault, even though the script seems to run fine. For example:

[03:13:01 argon:~]$ php -v
PHP 5.2.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 17 2007 02:28:25)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Segmentation fault: 11 (core dumped)
[03:13:02 argon:~]$

Whenever this happens, I can usually resolve the problem by changing the order of the modules listed in extensions.ini. Three times out of four, moving “extension=session.so” to the top of the file fixes the problem.

No Thumbnail for an Uploaded Image in WordPress

Thursday, September 13th, 2007

A Short Answer to a Specific Question:

If you upload an image in WordPress, and you don’t get the option to “Show Thumbnail” in the “Send to Editor”, it’s probably because the image was too big.

Also: there is no good way to resize an image in iPhoto.

A free tool to resize images on the Mac is ImageWell, from XtraLean Software.

Short Answers to Specific Questions

Thursday, September 13th, 2007

I’ll be perfectly frank; I don’t like blogs. For the most part, I think they’re pretentious, self centered, and everytime someone references “my audience” when they’re not talking about a show they were headlining at Shoreline, I have the mild urge to cram a squirrel in ’em.

That being said, though, I’ve often thought that if I were ever to start a blog, in addition to whatever hare-brained reason I had for doing it in the first place, I would also try to add a little bit to the sum total of human knowledge by occasionally posting the one thing I’m always grateful for when I’m lucky enough to find it: the short answer to the specific question.

From now on, when I’m searching for one specific piece of information, or the answer to a very direct technical question, I’ll try to post it here, so on the off chance that someone else is looking for it, they might stumble on it. You never know.