简体   繁体   English

如何将二进制内容加载到剪贴板而不删除或操作任何内容? (AutoHotkey的)

[英]How to load binary content to clipboard without anything removed or manipulated? (Autohotkey)

I have binary content stored in a file (containing previous clipboard content) is being modified (without purpose or adding code for this) every time I try to load it to clipboard. 我每次尝试将其加载到剪贴板时,都会修改存储在文件中的二进制内容(包含以前的剪贴板内容)(无目的或为此添加代码)。

The binary content represents organised paragraphs on OneNote copied to clipboard. 二进制内容表示复制到剪贴板的OneNote上的有组织段落。 In order to be able to use later, I saved the clipboard binary contents to test.clip file using: 为了能够以后使用,我使用以下命令将剪贴板二进制内容保存到test.clip文件:

FileAppend, %ClipboardAll%, C:\My\Path\test.clip

Then when I try to retrieve the binary file test.clip contents to clipboard using: 然后,当我尝试使用以下命令检索二进制文件test.clip内容到剪贴板:

FileRead, Clipboard, *c C:\My\Path\test.clip

And paste to OneNote, I get incomplete paragraphs from the ones that was copied before and saved to the binary file. 并粘贴到OneNote,我从之前复制并保存到二进制文件的段落中得到不完整的段落。

I tried to check the difference between the old binary file test.clip and the clipboard content after loading this file. 我试着在加载这个文件后检查旧的二进制文件test.clip和剪贴板内容之间的区别。 I saved the new clipboard content to test2.clip after retrieving test.clip to check if there's something manipulated or not using: 我在检索test.clip之后将新的剪贴板内容保存到test2.clip,以检查是否存在操作或未使用的内容:

FileRead, Clipboard, *c C:\My\Path\test.clip
FileAppend, %ClipboardAll%, C:\My\Path\test2.clip

I compared the two files test.clip and test2.clip (Which are expected to be the same). 我比较了两个文件test.cliptest2.clip (预计它们是相同的)。 I found that there's a block of binary code (at the end of the file) was removed after each load for test.clip to clipboard (The removed block is marked red in the below image): 我发现每次加载test.clip到剪贴板后都会删除一块二进制代码(在文件的末尾)(删除的块在下图中标记为红色): 在此输入图像描述

How could I fix this to load the binary clipboard content stored in test.clip without getting anything removed or manipulated from the actual file content? 我怎么能解决这个问题,加载存储在test.clip中的二进制剪贴板内容,而不从实际文件内容中删除或操作任何内容?

Don't use %ClipboardAll% here. 这里不要使用%ClipboardAll% Just use %clipboard% . 只需使用%clipboard%

" Clipboard is a built-in variable that reflects the current contents of the Windows clipboard if those contents can be expressed as text. 剪贴板是一个内置变量,它反映了Windows剪贴板的当前内容,如果这些内容可以表示为文本。
By contrast , ClipboardAll contains everything on the clipboard, such as pictures and formatting ." 相比之下ClipboardAll 包含剪贴板上的所有内容,例如图片和格式 。“
- https://autohotkey.com/docs/misc/Clipboard.htm - https://autohotkey.com/docs/misc/Clipboard.htm

Quoting from the docs again, I think i see your problem: " If ClipboardAll cannot retrieve one or more of the data objects (formats) on the clipboard , they will be omitted but all the remaining objects will be stored. " 再次从文档中引用,我认为我看到了你的问题:“ 如果ClipboardAll无法在剪贴板上检索一个或多个数据对象 (格式)它们将被省略, 但所有剩余的对象都将被存储。

As an example: 举个例子:

F4::
FileAppend, %Clipboard%, clipboardcontents.clip
FileRead, Clipboard, clipboardcontents.clip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何判断我的应用程序是否已从剪贴板侦听器链中删除? - How to tell if my application has been removed from the clipboard listener chain? 如何以二进制格式加载文件 - How to load file in binary format 如何获取完整的剪贴板内容,包括格式和链接? - How to get full clipboard content including formatting and links? 如何在不重新初始化当前帧内容的情况下将一帧的内容加载到另一帧 - How to load content of one frame into another frame without reintializing current frame content 如何在不使用真实剪贴板的情况下进行类似剪贴板的操作? - How can I do clipboard-like operations without using the real clipboard? 将剪贴板内容粘贴到记事本中的命令 - Command to paste the Clipboard content into Notepad 如何使用提升的AutoHotkey启动非提升程序? (没有任务计划程序) - How can I launch a non-elevated program with an elevated AutoHotkey? (Without Task Scheduler) 直接从Windows剪贴板获取二进制数据 - Getting binary data directly off the windows clipboard 无论如何让热键激活没有 AutoHotkey 的应用程序? - anyway to have a hotkey activate an application without AutoHotkey? Stop / Start.network in autohotkey 无需成为管理员 - Stop / Start network in autohotkey without needing to be an administrator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM