iMessage checker
I'm trying to do a number checker in imessage. We all know that there is no such api, so I'm trying to use the tools at hand. The main took with past issues on this site on this topic.
I made a loop that inserts a number into a string, and by the color of the number (blue - registered, red - missing), using the standard utility Digital Colors Meter determines the color of the number. Then, depending on the color, it either adds a variable with a number from the initial txt file to the new one, or starts the script from the beginning. At least it should be.
But something is going wrong. It checks the color, inserts numbers, everything is fine, but apparently the wrong condition, apparently the wrong data types. It inserts different numbers into the scatter. Some will insert, some will not, regardless of the initial condition. What could be the reason? Where is the error? And is it possible to make it so that after a certain number of verified numbers, he himself deleted open dialogs with these numbers?
repeat with n in client
activate application "Messages"
repeat
tell application "System Events" to tell process "Messages"
key code 45 using command down
keystroke n
delay 1
key code 36
tell application "Digital Color Meter" to activate
tell application "System Events"
tell process "Digital Color Meter"
click menu item 1 of menu 1 of menu bar item 4 of menu bar 1
end tell
do shell script "/usr/bin/python -c \"import objc;bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework');objc.loadBundleFunctions(bndl, globals(), [('CGWarpMouseCursorPosition', 'v{CGPoint=dd}')]);CGWarpMouseCursorPosition((" & 1002 & "," & 222 & "));\""
set rgbColors to words of (the clipboard)
end tell
if rgbColors is equal to {"77", "39", "38"} then
exit repeat
else
do shell script "echo " & quoted form of n & " >> /Users/oneone/Desktop/base2.txt"
end if
end tell
end repeat
end repeat
Solution 1:
Rather than guess at what AppleScript is doing, have you considered running it in a debugger to know the variables as it runs and errors out?
- https://latenightsw.com/
Some things that make it hard to make a better answer are the parts where you say:
The main took with past issues on this site on this topic.
And
but apparently the wrong condition, apparently the wrong data types
And mostly
Some will insert, some will not, regardless of the initial condition. What could be the reason? Where is the error? And is it possible to make it so that after a certain number of verified numbers, he himself deleted open dialogs with these numbers?
Since you don’t post input values or share output values were really guessing even more than you. I would get into the debugger so you can see the flow.