Since there will be lots of kinds of content put into clipboard, e.g. PNG, JPG, TXT, RTFD etc. I know I should determine the content type. Then I come up with Clipboard Condition :
It is frustrating that Clipboard Condition currently only supports the function of handling text. So, can I use Keyboard Maestro to determine what the type of content is in clipboard? In my case, if there is any way to automatically save the content of clipboard to hard drive that would be great.
Thanks to @ComplexPoint's very helpful clipboard viewer script, we can create a variable based off the current clipboard content and see if it contains the appropriate file extension or content type for what we want to do. An example for PNG and JPG files:
No problem, Oscar. Glad it's proving useful. I can't take credit for rewriting @ComplexPoint's JXA code, though; he was simply thoughtful enough to provide an AppleScript version as well (it's posted right beneath the JXA one in that thread) which I opted to use here, since it returns the data in a more straightforward format when saved to a KM variable.