Jump to content
Macro Express Forums

Looks Like Save Clipboard To Text Has 64 K Limit


Recommended Posts

I have a ME macro to save what I block on the screen in Windows as a text file.


I noticed some missing material.


I looked at the clipboard with clipboard viewer, and everything was there. I saved it to a text file and it was 267 K.


I wrote a ME macro consisting of only the save clipboard to text file command and executed it. The file was only 64 K and incomplete, what I had observed before.


The ME help documentation contains no warning that save text command is limited to 64 K.


This sucks big time. 64 K is not a lot of anything. Who knows now what I have failed to copy before? How can I know whether what I have blocked exceeds 64 K and I am going to lose something if I use my ME macro?

Link to comment
Share on other sites

I created this macro:


Variable Set String %T1% from File: "Foccode.txt"

Variable Modify String: Save %T1% to Clipboard

Clipboard Save Text: "Foccode1.txt"


Here is the relevant part of my folder listing, before and after running this macro:



Foccode txt 341,291 13/07/1999 00:02



Foccode txt 341,291 13/07/1999 00:02

Foccode1 txt 341,291 15/05/2005 18:36


So it works fine for me - I'm using v3.5c - build 1.

Link to comment
Share on other sites

Each macro command has a 64K (65,536) limit. If you were to use the Variable Set String command, you could only use a string 64K in size or smaller. There is not, however, a limit on the number of characters that can be contained in a variable. Some macros read the content of mulit-gigabyte files files into variables.


However, it should be noted that %T% variables are string variables. That is, they were designed to hold text, not binary data. Text is defined as viewable characters. (For the technical, values of 20 hex through ff hex plus a few non-printable characters such as Carriage Return (CR), Linefeed (LF) and Tab (HT).) If you put something in the variable that contains, for example, an ASCII 0 (a character value of 00 hex (NUL)), then you may not be able to copy all of the content of that variable to another variable.


The result of Paul's test macro indicates that Macro Express is not limiting what is read from the clipboard. Since your macro seems to be losing information we need to look elsewhere for the explanation.


Perhaps the information has been properly retrieved from the clipboard but it contains non-text characters. These non-text characters could make it seem like the information is missing when in fact it is simply inaccessible.



I had another thought: What are you copying from? If you are, for example, within a Word document, when you copy information from the screen to the clipboard, the clipboard may contain non-printable characters. The variable may contain the full 270K of data but you may not be able to access beyond a certain point.

Link to comment
Share on other sites

I did the following.


I looked for a large txt file on my system that is widely distributed. The first one I saw was win32api.txt. I found it in Program files\Microsoft Visual Studio\Common\Tools\winapi. It was 667,783 KB and dated 6 18 98. Presumably this is a clean text file with no special characters.


I copied a one character string into the clipboard and viewed the clipboard with clipboard viewer to verify that it contained the one byte string.


I then loaded win32api.txt into wordpad. I verified the last line:


Const BF_MONO = &H8000 ' For monochrome borders.


I loaded the file into the old WordPerfect editor. I saw the same last line.


I did a control A to select all the text in Wordpad. Note that I am selecting text from the screen.


I ran a Macro Express macro that did a clipboard copy command followed by a save clipboard to file command.


I viewed the clipboard with editor2, the editor program in the xplorer2 file manager package. I like the package because its dual pane display looks and works much like the old DOS WordPerfect file manager program. I have a ME macro that executes the program and pastes the clipboard. I looked at the last line. It was the line about monochrome borders.


I saved the file from editor2 as a text file. The file size was 667,684. I will over look the 1 byte difference for present purposes.


This results tells me that the ME copy clipboard command in my macro worked.


I then looked at the file saved with the macro express save to text file command. The size is 64,002, again suggesting there is a 64 K limit in ME limiting the size of the file saved..


I then looked at the clipboard with Windows 98 clipboard viewer. That program seemed to have a different last line every time I executed it and it was only a faction of the file save by ME. I couldn't understand why it seemed to work differently each time I used it.


I opened WordPad again and pasted the clipboard into it. All of the file was there.


My OS is Win 98 SE.


It looks to me like something in the ME save clipboard to text file is not working right.

Link to comment
Share on other sites



Thank you for provided details about your test. I was able to duplicate this. It turns out that the key piece of information is that you are using Windows 98. You have identified a previously undocumented limitation.


The Clipboard Save Text command works fine in Windows XP. On Windows 98 only the first 64K of the clipboard is saved.


This limitation also exists for the Variable Set String %T1% from Clipboard command.


We will add a note to the documentation describing this. Our initial research indicates that the limitation may affect Windows 98/Me/95 users.

Link to comment
Share on other sites

We have confirmed that this limitation exists in Windows 98, Me, and 95. While the underlying cause is with Windows itself, we have identified a possible workaround that may fix this. We will be looking at this for a future release of Macro Express. In the meantime, we will update the documentation to include a warning.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...