Can someone help me out here . . . I’m trying to build a script to make iMovie import using UI scripting, but can’t get the “Import” button to activate. Has someone else figured this out already? I’ve succeeded in making a script just by clicking at certain coordinates, and it seems to work most of the time, but it’s a dirty hack. If someone knows how to activate that ‘Import’ button without having to know its coordinates on the screen, that would be a great advancement. Here’s the script I came up with so far:
Start Importing:
tell application "iMovie" to activate
delay 10
tell application "System Events"
get properties
tell process "iMovie"
set frontmost to true
click at {564, 538}
end tell
end tell
Stop Importing:
tell application "System Events"
get properties
tell process "iMovie"
set frontmost to true
click at {564, 538}
end tell
end tell
Of course, I have to have the window at a specific position to make this work. I determine the position of the button by moving iMovie’s window to somplace I want to keep it and not movie it again; then I launch UIElementInspector and hover the cursor over the ‘import’ button in iMovie, and it displays the coordinates. Once you set up the script, you can’t move the iMovie window without having to change the script. Once I have the scripts done, I use Cronnix (an excellent - and free - app for setting up cron automated tasks), and I set up the start and stop times of recording. It’s a lousy solution, but it works. If someone could tell me how to click that import button in iMovie without knowing its position, that would make it perfect.