[Feature Request] ClipboardAll -> ClipboardObject

Propose new features and changes
azure
Posts: 4
Joined: 26 Jun 2023, 03:14

[Feature Request] ClipboardAll -> ClipboardObject

Post by azure » 30 Jun 2023, 20:31

Although ClipboardAll contains all clipboard data, we seem to be able to use it only for clipboard backup and restore. We can't use it to get other useful data like "HTML Format" or "CF_DIB".

We can make use of this data by simply adjusting the object structure of the output. e.g returning
{49325: {Format: "HTML Format", Buf: _}, 13: {Format: "CF_UNICODETEXT", Buf: _}, ...}

This doesn't break the current ClipboardAll functionality, but we can make better use of the clipboard data.

Code: Select all

obj := ClipboardObject()
MsgBox "HTML Format: `n" StrGet(obj[49325].buf, "utf-8")
Of course, we also have some clipboard libraries that can implement similar functionality, but I prefer to use the built-in methods if they are available.


[Mod action: Moved topic from “AutoHotkey Development”]
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Feature Request] ClipboardAll -> ClipboardObject

Post by lexikos » 30 Jun 2023, 21:10

I tentatively plan to add methods to ClipboardAll for inspecting/extracting or modifying its contents, but this fell outside the scope of v2.0 (and honestly isn't interesting enough for me to implement it soon).

The format of the data contained by ClipboardAll is documented, so a script can enumerate its contents with a little work.
azure
Posts: 4
Joined: 26 Jun 2023, 03:14

Re: [Feature Request] ClipboardAll -> ClipboardObject

Post by azure » 01 Jul 2023, 09:52

Thanks a lot. If these methods are not complicated to implement can you prioritize it? If not, can you add a description of the structure of this buffer data in the documentation? This way we can read the corresponding data manually.
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Feature Request] ClipboardAll -> ClipboardObject

Post by lexikos » 02 Jul 2023, 01:38

As I said: it's not interesting enough to me, and the format is already documented.
iseahound
Posts: 1472
Joined: 13 Aug 2016, 21:04
Contact:

Re: [Feature Request] ClipboardAll -> ClipboardObject

Post by iseahound » 02 Jul 2023, 18:50

The binary data contained by the object consists of a four-byte format type, followed by a four-byte data-block size, followed by the data-block for that format. If the clipboard contained more than one format (which is almost always the case), these three items are repeated until all the formats are included. The data ends with a four-byte format type of 0.
Huh it is documented.
Post Reply

Return to “Wish List”