Hi,is it possible for a script to create a clipboard content file? For example, after pressing "Print Screen" I get the screen captured into memory, but can I create an object which has that memory (paste) content? If we have a text and an image copied simultaneously - can we access both of them separately? Can we verify whether it's a proper txt/bmp format? I would intend then to save the captured clipboard as a *.JPG/*.TXT file with some index number in the file name.

Clipboard access from active scripting, using standard available objects, is very limited. Only with specific ActiveX objects this would be feasible.Even to just copy/paste text there is the need to use tricks like this:

If you are OK installing a third-party tool, then install a 32-bit version of ImageMagick, making sure you selected the "Install ImageMagickObject OLE Control..." additional tasks option, and then you can save the image in the clipboard, and process it, like this:

If you are OK installing a third-party tool, then install a 32-bit version of ImageMagick

If there's no better way to capture image clipboard data - ImageMagick is fine. It's a great tool - it is even allowed to be used freely for personal or commercial purposes. Thank you for the solution - the code works fine now!

I have a question about your CopyTextToClipboard/GetTextFromClipboard methods. They seem to work "a bit slower" than the usual code and perhaps that is because of the While cycles with the Sleep() method:

while(oIe.ReadyState!=4) WScript.Sleep(20);while(oIe.document.readyState!='complete') WSript.Sleep(20);but removing these lines gives no problem to the methods. And trying to paste ~200kb of clipboard text data raises no issues (other than the waiting time). Are they really necessary? What should they help with?

I have a question about your CopyTextToClipboard/GetTextFromClipboard methods. They seem to work "a bit slower" than the usual code and perhaps that is because of the While cycles with the Sleep() method:

while(oIe.ReadyState!=4) WScript.Sleep(20);while(oIe.document.readyState!='complete') WSript.Sleep(20);but removing these lines gives no problem to the methods. And trying to paste ~200kb of clipboard text data raises no issues (other than the waiting time). Are they really necessary? What should they help with?

This is not my code, but these sleep values are indeed too high. A sleep(1) is enough, and the while(oIe.document.readyState!='complete') line is not really needed in this case. Checking if the browser is ready to accept interaction with the loaded document is really needed, or the script will fail if a command is sent before, but with modern fast PCs it gets ready soon than when this code got write. The amount of what is copied/pasted is not the issue here.

Thanks for the reply. I've modified the code lines accordingly.Lastly, I would like to ask, whether we can escape the need to install ImageMagick at all. I found c++ code sample where you can register a *.dll for creating ImageMagickObject:https://www.autoitscript.com/forum/topic/117914-imagemagickobject-object/?page=2Do you think it's possible to get our clipboard image capture function using only "\ImageMagickObject.dll" with JS instead?

First time I see this one. But it seems it is limited to text only, so the IE trick does the same without the need to install and register anything else. I haven't needed clipboard access from scripts yet, and I can always add this functionality to the scripts API.