Forked from lexrus/delete_all_imessage_conversations.applescript
Created
November 3, 2022 20:40
-
-
Save iconifyit/f8bf26dfa63020790274f8de5bf5b48b to your computer and use it in GitHub Desktop.
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# System Preferences -> Accessibility -> Display -> Reduce motion | |
tell application "Messages" to activate | |
tell application "Messages" | |
set chatCount to (count of chats) | |
end tell | |
tell application "System Events" | |
tell process "Messages" | |
set frontmost to true | |
repeat chatCount times | |
click menu item "Delete Conversation…" of menu "File" of menu bar 1 | |
delay 0.2 | |
click button "Delete" of sheet 1 of window 1 | |
delay 0.2 | |
try | |
click button "Report Junk" of sheet 1 of window 1 | |
delay 0.2 | |
on error errMessage number errNumber | |
end try | |
click menu item "Go to Next Conversation" of menu "Window" of menu bar 1 | |
delay 0.2 | |
end repeat | |
end tell | |
end tell |
It's kind of a mess. I wrote it to just clear my old chats and have not had a chance to "product-ize" it yet but anyone is welcome to use it. https://github.com/iconifyit/batch-delete-imessages
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very cool. This was the final pieced I needed on my own script. I hacked together AppleScript, shell scripts, and Python to export my contacts from the Contacts app, then search my contacts for each sender and delete them if they are not in my contacts but retain them if they are. Happy to share it.