Thanks for the help. Progress!
Yvan,
After your first reply, I did check Accessibility Inspector again, found it’s a “…” (single character ellipsis) not a “…” (three periods), but correcting that didn’t have any effect. I should have mentioned I had tried that in my last post, thank you for the suggestion.
Nigel,
Thanks, I had noticed that too, and tried changing it to:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
-- [etc]
Running this:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 0.2
set theWindows to the name of every window
set theElements to the name of every UI element of window "Channels"
end tell
end tell
“theWindows” is:
{"Script", "Color Converter", "Info", "Channels", "Island Preseps.psd"}
Which sounds promising, but “theElements” is:
{“Channels”, missing value, “111%”, “∑:”, missing value, missing value}
Which doesn’t sound promising at all.
The “Channels” and “∑:” elements are static text, the “111%” is a changing readout of a value the mouse is over on an image. Everything else it sees is “missing value,” and even then, 3 missing values isn’t nearly enough UI elements for the window.
Although it’s interesting to me that when I tell it to use a UI element, the error message is that it “Can’t get window ‘Channels,’” but it actually can get the window “channels,” just nothing of use below that level.
I dug deeper into the “missing value” name elements:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 0.2
set channelsWindow to window "Channels"
set namesNroles to {the name of every UI element of channelsWindow, the role of every UI element of channelsWindow}
end tell
end tell
which revealed that UI Element 6 is a pop up button:
{{"Channels", missing value, "246%", "∑:", missing value, missing value}, {"AXStaticText", "AXGrowArea", "AXStaticText", "AXStaticText", "AXScrollBar", "AXPopUpButton"}}
Progress… tried this:
tell application "System Events"
tell application process "ICISS Scanner"
delay 0.2
set channelsWindow to window "Channels"
set flyoutMenu to the first UI element of channelsWindow whose role is "AXPopUpButton"
tell flyoutMenu
click it
delay 0.1
click menu item "Add…"
end tell
end tell
end tell
New error - "can’t get menu item ‘Add…’
I never see the menu pull out following the “click it” command. In case just that’s going wrong, I tried this:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 2
set channelsWindow to window "Channels"
set flyoutMenu to the first UI element of channelsWindow whose role is "AXPopUpButton"
tell flyoutMenu
set menuProps to the properties
end tell
end tell
end tell
And then with that 2-second delay I manually clicked the pop-up menu and left it up, hoping the script could read it’s contents. No luck there, menuProps is:
{minimum value:0, orientation:missing value, position:{183, 298}, role description:"pop up button", accessibility description:missing value, focused:false, title:"", size:{16, 16}, value:0, help:missing value, enabled:true, maximum value:1, role:"AXPopUpButton", entire contents:{}, subrole:missing value, selected:missing value, name:missing value, description:"pop up button"}
Tried this:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 2
set channelsWindow to window "Channels"
set flyoutMenu to the first UI element of channelsWindow whose role is "AXPopUpButton"
tell flyoutMenu
set menuElements to every UI element
end tell
end tell
end tell
With the manual click.
now menuElements is:
menu 1 of pop up button 1 of window “Channels” of application process “ICISS Scanner”
so tried this:
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 2
set channelsWindow to window "Channels"
set flyoutMenu to the first UI element of channelsWindow whose role is "AXPopUpButton"
tell flyoutMenu
tell menu 1
set menuElements to every UI element
end tell
end tell
end tell
end tell
With the manual click, and menuElements is now:
{menu item "Edit…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Add…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Remove" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item 4 of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Preferences…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Switch reading" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Switch colormodel" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Show input channels" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item 9 of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Load Channelset…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Save Channelset…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item 12 of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Save as default…" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Reset to default" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item 15 of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item " Empty" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Euroscale CMYK" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "Pure CMYK" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner", menu item "RGB" of menu 1 of pop up button 1 of window "Channels" of application process "ICISS Scanner"}
So that’s great.
But this does rely on the manual click - if I take it out, I get “can’t get 'menu item 1.”
Same with this: “can’t get ‘menu item 1.’”
tell application "ICISS Scanner" to activate
delay 0.2
tell application "System Events"
tell application process "ICISS Scanner"
delay 2
set channelsWindow to window "Channels"
set flyoutMenu to the first UI element of channelsWindow whose role is "AXPopUpButton"
tell flyoutMenu
click it
delay 0.1
tell menu 1
click it
delay 0.1
set menuElements to every UI element
end tell
end tell
end tell
end tell
Any ideas where the “click” could be going wrong?
I’m curious if anyone has any more ideas, but this isn’t a bottleneck for me anymore because I have an inelegant but functional mouse-clicking script automating everything I need from this application.