I have my cable TV running through an old VCR, which is connected to my Mac using my mini DV camera as a bridge. I wanted to record some of my favorite shows onto DVD without commercials. After trying GCam and QuickTime Broadcaster, I decided I preferred the quality I got using iMovie the best. On the plus side, it's a breeze to cut out commercials, make chapters and create an iDVD project.
But some of the shows I want only air late at night when I prefer to be asleep. Since iMovie isn't AppleScriptable, I gave UIElementInspector a whirl. As it turns out, some of iMovie's elements have names and parents with names, but many do not. After trial and error, I came up with the following two AppleScripts. I schedule them to run at appropriate times using iKey, but I'm sure cron and osascript would work just as well, along with any number of other "timed" launchers.
As I am not an adept AppleScripter, I have to make sure that iMovie is already open with a "fresh" project file ready and waiting. Start Importing.scpt
tell application "iMovie"
activate
end tell
-- Start recording
tell application "System Events"
tell process "iMovie"
tell window 1
tell group 3
-- Make sure we start in edit mode
-- so that the following toggle button
-- works as desired
click button 3
-- Now switch to camera mode
click button 2
end tell
tell group 1
click button "Import"
end tell
end tell
end tell
end tell
Stop Importing.scpt
tell application "iMovie"
activate
end tell
-- Stop recording
tell application "System Events"
tell process "iMovie"
tell window 1
tell group 1
click button "Import"
end tell
tell group 3
click button 2
end tell
end tell
tell menu bar 1
tell menu bar item "File"
tell menu "File"
click menu item "Save Project"
end tell
end tell
end tell
end tell
end tell
This screenshot may help explain how some of the scripting works...
Mac OS X Hints
http://hints.macworld.com/article.php?story=20041006011654395