PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 11, 2022

[FIXED] How do I CLICK the 'delete' button in the popup from MESSAGES in MacOS Big Sur using AppleScript?

 July 11, 2022     applescript, click, macos-big-sur, message, popup     No comments   

Issue

What is the simple way to get the 'delete' button 'clicked' in response to the popup pictured below from the Messages app? I've tried more variations than I care to admit and am feeling humbled.

This code works fine if I want to 'click' the 'cancel' button in the popup.

But nothing I have tried has worked to click the 'delete' button.

Messages popup after delete message pulldown

tell application "Messages"
    activate
end tell

tell application "System Events"
    key code 2 using command down
end tell


tell application "System Events"
    set frontmost to true
    delay 1
    click button "Cancel"
end tell

Solution

This should work for you.

tell application "System Events" to tell application process "Messages"
    set frontmost to true
    repeat until frontmost
        delay 0.1
    end repeat
    click UI element "Delete" of sheet 1 of window 1
end tell


Answered By - wch1zpink
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing