How to Detect NULL Values

There are four cases here:

  1. a picture below the text (it is not a picture, but a file address)

  2. a picture in the middle of the text

  3. a direct copy of the picture without the text, i.e. blank, which I detect with ^$ (to put all cases together, so I just replace blank with other cases)

  4. just the text, without the picture (in this case, by (? <=\n$). *|^$ expression can't match any value)

The first three cases, you can match the NULL value, only the last case can't be matched, which means I just need to detect the NULL value to match whether the picture is copied (it's not a picture, but a file link)

Detect NULL
I can't detect this value directly by Search System Clipboard Using Regular Expression (ignoring case) method.

So I use another method Search and Replace System Clipboard Using Regular Expression (ignoring case) to replace it first and then query it. It doesn't look very straightforward, but it works for me.

Detect NUL.kmmacros (11 KB)

Image

My goal was to extract the image addresses from the script provided to me by @ComplexPoint. The process is complicated because I use a software called Eudic English dictionary, which is not in a regular format and cannot be read directly by the clipboard. But one thing is strange, when I drag the image directly to Keyboard Maestro, it can read the address of this image.I think there is a simpler way, but I don't know how to do it.

Screen Recording 2022-10-05 at 13.53.24.2022-10-05 13_55_46

Here is the link to the entire question.

Jone

1 Like