Hi,
I am trying to select some pictures in an app that has a NSCollectionView. To do that I started by creating a small script that gets the position and size of the app’s window.
I then tell system events to click random points inside a bounding box defined by the origin and size of that window. I should be getting feedback on the clicks by seeing the element selected, but I don’t see anything. How do I know that I am really clicking ?
Below is the script that can be adapted to another app.
tell application "System Events" to tell process "XekMyPic"
set client_size to get size of window 1
set width to item 1 of client_size
set height to item 2 of client_size
set client_pos to get position of window 1
set wnd_xpos to item 1 of client_pos
set wnd_ypos to item 2 of client_pos
end tell
tell application "System Events"
repeat 10 times
set xposition to wnd_xpos + (random number from 43 to width - 55)
set yposition to wnd_ypos + (random number from 305 to height - 400)
set xposstr to xposition as string
set yposstr to yposition as string
display dialog xposstr & ", " & yposstr
click at {xposition, yposition}
delay 3
end repeat
end tell
Thanks