There are four cases here:
-
a picture below the text (it is not a picture, but a file address)
-
a picture in the middle of the text
-
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) -
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)
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.
Here is the link to the entire question.
Jone