Last active
November 12, 2022 17:16
-
-
Save crbyxwpzfl/f0775a27cadbb3b66dae03de2f767aa0 to your computer and use it in GitHub Desktop.
apple script find a imessage to automate tapback for any message
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
tell application "System Events" to tell process "Messages" | |
--get role of group of win | |
--get description of group 1 of group 10 of group of group of group of group of group 3 of group of group of group of group of group of group 1 of win | |
--tell win | |
-- tell group 10 of group of group of group of group of group 3 of group of group of group of group of group of group 1 | |
-- UI elements | |
-- get description | |
-- perform action "AXShowMenu" | |
-- end tell | |
--end tell | |
--set frontmost to true | |
--delay 1 | |
--get actions of group 1 of group 10 of group of group of group of group of group 3 of group of group of group of group of group of group 1 of win | |
--perform action "AXShowMenu" of group 1 of group 10 of group 1 of group 1 of group 1 of group 1 of group 3 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of win | |
--get description of group 1 of group 9 of group of group of group of group of group 3 of group of group of group of group of group of group 1 of win | |
--get acitons of group of group of group of group of group 3 of group of group of group of group of group of group 1 of win whose description contains "Ok so read means revived" | |
-- make shure messages is open | |
set win to window "CHAT NAME" --put window name here usually this is just conntact name | |
set glist to (description of every group of group of group of group of group of group 3 of group of group of group of group of group of group 1 of win) --this gets description list nested in other usles lists of parent groups | |
set finallist to item 1 of item 1 of item 1 of item 1 of item 1 of item 1 of item 1 of item 1 of item 1 of glist --this gets the inner most list of descriptions | |
repeat with n from 1 to count of finallist | |
if item n of finallist contains "MESSAGE" then -- here search for message text in description | |
log n | |
set frontmost to true -- focus messages just to be sure | |
delay 1 | |
perform action "AXShowMenu" of group 1 of group n of group 1 of group 1 of group 1 of group 1 of group 3 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of win --actually showing menu | |
--here simulating cmd + t then woud enter tapback and then 12345 would acutally tapback etc etc | |
end if | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
current state - prettier but a lot slower. not good as well
original - hi my apple script is bad please help make this fuck prettier, this was so hard for me to put to gether.
finding all the nested ui groups corectly was so tedious.
info links i used to pice this together search lists 1 / search lists 2 / find uielemnt 1 / find uielemnt 2 / find uielemnt 3
further ranting.… apples accessibility inspector was not telling me the correct hirachy but perhaps that was user error.
anyway finally found the right ui groups by manually returning
Ui elemnts
one group deeper at a time.