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...

