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 in loop. 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?

    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
        do shell script "echo " & quoted form of n & " >> /Users/oneone/Desktop/base2.txt"
    end if

Only the color check condition for Digital Color Meter is presented here. Through the do shell, the color is read at the mouse position and the variable is added to the new file.

  • 1
    Welcome to Ask Different. Stack overflow has an excellent concept of MCVE which stands for minimal, complete, verifiable example where you simplify your code to have one and only one question. stackoverflow.com/help/minimal-reproducible-example We may close this to allow clarification to show what your input is, what your output is and what you want the output to be. – bmike Dec 7 '19 at 15:37
  • I have already corrected the questions and no one can give me an answer. And my questions close. What is the problem? – MarshmallowRose Dec 7 '19 at 15:43
  • I sent you a moderator message. We can discuss on the non-duplicate. Basically you’re not showing your work in a reproducible way. You say it inserts different numbers. Show the 3 input numbers you input so someone can try to reproduce your results – bmike Dec 7 '19 at 15:46
  • You can enter absolutely any number, as long as 1 was registered in imessage. – MarshmallowRose Dec 7 '19 at 15:48

Browse other questions tagged .