Open iMovie with alt down from AppleScript

applescriptimovie

How to open iMovie with alt from keyboard with AppleScript?

Best Answer

Here is a script by maeks84 which does the same for iPhoto that might help you with accomplishing the same for iMovie (need to post as answer due to the length). Code inserted in case it ever goes down..

--maeks84@gmail.com
--http://maeks84.wordpress.com

property libraryPath : "Macintosh HD:Users:Path:to:iPhoto Library"

--Determine if iPhoto is open and needs to be quit
--Will only bring iPhoto to the front if the correct library is already open
tell application "System Events"
    if exists process "iPhoto" then --Only worries about the current user
        tell application "iPhoto"
            if image path of photo 1 does not contain POSIX path of libraryPath then
                activate
                beep
                display dialog "About to quit iPhoto!" giving up after 300 --Gives a chance to cancel otherwise continues on
                quit
                tell application "System Events"
                    repeat while exists process "iPhoto"
                        delay 3
                    end repeat
                end tell
                my launch_library()
            else
                activate
            end if
        end tell
    else --iPhoto is not currently running
        my launch_library()
    end if
end tell

on launch_library()
    do shell script "defaults write com.apple.iPhoto RootDirectory " & quoted form of POSIX path of libraryPath
    tell application "iPhoto" to activate
    tell application "System Events"
        repeat while (exists process "iPhoto") is false --Delay until iPhoto is launched
            delay 5
        end repeat
    end tell
    do shell script "defaults remove com.apple.iPhoto RootDirectory" --Restore the default library
end launch_library