Hello
I'm surprised by an odd behavior. I was asked about the way to click somewhere in a script. So I wrote a short script offering different ways to do the trick and tested it under 10.9.1.
activate application "TextEdit" tell application "System Events" to tell (first process whose frontmost is true) tell first window keystroke "p" using {command down} repeat delay 0.1 if exists sheet 1 then exit repeat end repeat tell sheet 1 set {x, y} to get position of first menu button as list # click at {x, y} # (1) fails --> 10.8.5 : error missing value --> 10.9.1 : error "Erreur dans System Events : Il est impossible de rendre {243, 680} en type list." number -1700 from {243, 680} to list click first menu button # works well # tell first menu button to perform action "AXPress" # works well # tell me to do shell script "/usr/bin/cliclick c:" & x & "," & y # works well # tell application "ASObjC Runner" to click button once at {x, y} # works well end tell end tell # click at {x, y} # (2) --> 10.8.5 : works well --> 10.9.1 : error "Erreur dans System Events : Il est impossible de rendre {243, 680} en type list." number -1700 from {243, 680} to list end tell
I was really puzzled when I discovered that the standard instruction click at {x, y} failed with : --> error "Erreur dans System Events : Il est impossible de rendre {243, 680} en type list." number -1700 from {243, 680} to list
I decided to test under 10.8.5. When the instruction was in the block tell first window (1), it issued an error missing value When it was out of the block (2), it worked flawlessly.
So I returned to 10.9.1 and when the instruction is out of the block (2), it fails exactly as it does in the block (1).
Would be fine to know if you get the same behavior on your machines.
Yvan KOENIG (VALLAURIS, France) jeudi 2 janvier 2014 18:03:56
|