I am new to this, but I was wondering why my button acts like it clicks (button highlights on and off as if being clicked), but it does nothing. I will post my code. Any help would be greatly appreciated.
tell application "Adobe Illustrator"
activate
end tell
tell application "System Events"
tell process "Adobe Illustrator"
tell menu bar 1
tell menu bar item "Edit"
tell menu "Edit"
pick menu item "Find and Replace..."
keystroke "boy"
keystroke tab
keystroke "girl"
end tell
end tell
end tell
end tell
tell process "Adobe Illustrator"
tell window "Find and Replace"
click button "Done"
end tell
end tell
end tell
no idea why your click doesn’t work, but I think you can simply replace it by ‘keystroke return’ since this button is default:
tell application "Adobe Illustrator"
activate
end tell
tell application "System Events"
tell process "Adobe Illustrator"
tell menu bar 1
tell menu bar item "Edit"
tell menu "Edit"
pick menu item "Find and Replace..."
keystroke "boy"
keystroke tab
keystroke "girl"
keystroke return
end tell
end tell
end tell
end tell
end tell
Ah I’m sorry, meant to change that (syptoms of working to late). Wanted the clicked button to be “Find”. Actually that is my exact problem. I can’t get any buttons other than the default buttons to click. I was able to use keystroke return to get the default button to click. Any ideas why the “click” action would make the button appear to click, but then the palette remains and nothing happens?
REVISED SCRIPT
tell application "Adobe Illustrator"
activate
end tell
tell application "System Events"
tell process "Adobe Illustrator"
tell menu bar 1
tell menu bar item "Edit"
tell menu "Edit"
pick menu item "Find and Replace..."
keystroke "boy"
keystroke tab
keystroke "girl"
end tell
end tell
end tell
end tell
tell process "Adobe Illustrator"
tell window "Find and Replace"
click button "Find"
end tell
end tell
end tell
Please help. I know I am a newbie at this, but I really want to understand this stuff. You guys and gals are great and I really appreciate your help. Thanks in advance!
I have played a little with Illustrator - I am afraid these buttons are simply not scriptable at all. Probably the acessibility support of these UI elements was not properly inplemented by Adobe ;-(.
In my opinion the only workaround could be trying to write your own search and replace routine …
Thank you so much for your help Dominik.
I have pretty much came to the same conclusion. So close yet so far away. It’s just frustrating when you can see the click occur and nothing happens. Do you know how often this sort of thing happens. I mean I though applescript GUI could pretty much script anything.
Oh well, guess I’ll have to figure out a work-around. Like I said, thanks so much for your help. Good to know that people still help people.
tell application "Adobe Illustrator"
activate
end tell
tell application "System Events"
tell process "Adobe Illustrator"
tell menu bar 1
tell menu bar item "Edit"
tell menu "Edit"
pick menu item "Find and Replace..."
keystroke "boy"
keystroke tab
keystroke "girl"
end tell
end tell
end tell
tell process "Adobe Illustrator"
set winPosition to position of window "Find and Replace"
end tell
end tell
tell application "Extra Suites"
ES move mouse {((item 1 of winPosition) + 465), ((item 2 of winPosition) + 45)}
ES click mouse
end tell
Note: 465 and 45 are the x and y alues for my Illustrator’s search window (Illustrator CS, german). Yours will probably need other values …