I’m trying to write a script that will set a preference in Image Capture, and I’m having trouble selecting an item in a popup button. Here’s what I have so far:
tell application "Image Capture"
activate
tell application "System Events"
tell process "Image Capture"
click menu item "Preferences..." of menu "Image Capture" of menu bar 1
click menu item "Other..." of popup button 1 of window "Image Capture Preferences"
end tell --process "Image Capture"
end tell --application "System Events"
end tell --application "Image Capture"
When I run this, the preferences window comes up, but I get an error saying “Syntax Error - Expected end of line, etc. but found class name.” When this comes up, the word “button” is highlighted in the line,
click menu item "Other..." of popup button 1 of window "Image Capture Preferences"
I have a feeling that I’m accessing the popup button wrong, but I don’t know how to go about accessing it if that’s not right. Any suggestions?
I’ve made some progress, but I’m more confused now than I was before… If I use the following code,
tell application "Image Capture"
--open Image Capture
activate
--use System Events to...
tell application "System Events"
--tell Image Capture to...
tell process "Image Capture"
--open the preferences window
click menu item "Preferences..." of menu "Image Capture" of menu bar 1
--within the preferences window...
tell window "Image Capture Preferences"
--using the "What to do when a camera is inserted" menu
tell pop up button 1
--click the menu
click
--within the menu
tell menu 1
--choose "iPhoto"
click menu item "iPhoto"
end tell --menu 1
end tell --pop up button 1
end tell --window "Image Capture Preferences"
end tell --process "Image Capture"
end tell --application "System Events"
--quit Image Capture
quit
end tell --application "Image Capture"
I have no problems. Image Capture opens, opens its preferences window, and chooses iPhoto as the default option for when a camera is connected.
However, if I change
click menu item "iPhoto"
to
click menu item "Other..."
it no longer works. Everything opens, and the pop up button is clicked, but it will not select “Other…”. Any ideas why this might be happening?
An ellipsis is typed using the "option + ; " key combo – (that’s hold down the Option Key and hit the semi-colon key)
This is an elipsis … , which is a single character and it is what’s used in the Menu Items. This is three periods … , which is 3 separate characters. They look alike on this BBS, but if you type them into TextEdit, you’ll see the difference.