2

I use a web-based program that lacks batch actions. This creates the need for repetitive clicking. I wrote a script on Apple's Script Editor that took care of that, it is very simple and worked perfectly. However, as of yesterday it no longer works, for some reason.

I'm using Brave browser, but even outside the browser, clicking in general seems to no longer work. I've set different coordinates to click icons on the desktop and whatnot. Nothing works.

This is the script:

set loc1 to {400, 440} -- x, y coordinates
set loc2 to {1350, 700}

delay 2 -- time for me to minimize scripts and click on browser
repeat 60 times --  :)
    tell application "System Events"
        click at loc1 --clicks on a button to open item from a list
        delay 2 -- time for item to open
        click at loc2 -- clicks the approve button
        delay 5 -- time for the list to update
        
    end tell
end repeat

This is the feedback I get under the replies tab of the Script Editor

tell application "System Events"
    click at {400, 440}
        --> missing value
    click at {1350, 700}
        --> missing value
end tell

This worked until about a week ago. I did not update anything, and did not change the script. I'm really baffled that it just stopped working. Surely I'm missing something.

I'm running MacOS Catalina 10.15.7, on a 2017 13" MacBook Pro.

Thank you

*edit: Just to be clear, I would appreciate either an alternative method to solve this problem or a possible explanation for why it stopped working. Cheers

2 Answers 2

0

I gave up on fixing whatever happened to the script and used cliclicks instead. So I'm now just trying to figure out why it stopped working, for educational purposes.

I replaced the original script with the solution on this thread:

How can I automate repeat mouse clicks, with delay, from fixed coordinates within a browser window?

0

If you are not clicking on a UI element, the click command needs to be sent to an application process… NOT an application.

NOTE: I'm not 100% sure but I believe the click command at a specific coordinate only works if the coordinate is at a clickable UI element.

See if this works for you.

set loc1 to {400, 440} -- x, y coordinates
set loc2 to {1350, 700}

repeat 60 times --  :)
    tell application "System Events" to tell process "Brave Browser"
        set frontmost to true
        repeat until frontmost
            delay 0.1
        end repeat
        delay 0.1
        click at loc1 --clicks on a button to open item from a list
        delay 2 -- time for item to open
        click at loc2 -- clicks the approve button
        delay 5 -- time for the list to update
    end tell
end repeat

UPDATE: If the above code does not work, this following edited code works for me.

set loc1 to {1420, 47} -- Drop down search tabs menu upper right of "Brave Browser"
set loc2 to {349, 47} -- New tab button in "Brave Browser"

tell application "Brave Browser" to activate

tell application "System Events"
    tell process "Brave Browser"
        set frontmost to true
        repeat until frontmost
            delay 0.1
        end repeat
    end tell
    delay 1
    click at loc1 --clicks on drop down search tabs menu button 
    delay 1
    click at loc1 --clicks on drop down search tabs menu button 
    delay 1
    click at loc2 -- clicks the "New Tab" button
    delay 1
    click at {590, 45} -- clicks new location of the "New Tab" button
    delay 1
end tell

enter image description here

1
  • Tried this, it would pull the browser to the front, but wouldn't click. Jun 27, 2023 at 20:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .