Jump to content
Macro Express Forums

Copying from Word File to Clipboard without Opening?

Recommended Posts


I have library system application in which I need to be able to type Unicode characters in (specifically roman letters with diacritics). The application does NOT accept any input of Unicode characters via any combination of keyboard characters (i.e., it is not possible to use a macro that uses a combination of the Unicode value plus escape keys).

The application DOES accept input of Unicode characters by three methods -- paste from clipboard, the invoking and clicking on the character in the Windows character map, Zombie keys character map.

Since we will need to key in lots of words with diacritics, the Windows character map option is out. Zombie keys might be a possibility, but since we are already using Macro Express and a Chrome Extension to provide productivity tools for this application, I'm reluctant to add yet another "add-on" application to the mix. 

So, the question is, can the paste from Clipboard option be made use of? I thought of having a Word file for each diacritic-letter combination in question (for example an h with a dot under it), and then having a macro copy the contents of that file of the relevant keyboard to the Clipboard and then pasting it from the clipboard. But I can't figure out a way to copy the contents of a Word file to the Clipboard without opening it. (Having to open the file and highlight and copy the text and close the file each time would be completely unworkable.)

Is the answer "no way to do this" or is there some trick out there to copying a Word file to the Clipboard?

Thanks in advance for any light you can shed on this!

Link to comment
Share on other sites

I may not sufficiently understand Unicode, so I don't know if these ideas will get you closer to your goal ...

(1) You can save a Notepad file in Unicode format by selecting "File - Save As" and specifying Unicode "Encoding" at the bottom of the Save screen.  Macro Express can internally open and read the file (very fast), without displaying it anywhere, using commands ASCII File Begin Process or Text File Begin Process.  Once the macro reads the data into a text variable it can be moved to the clipboard.  Presumably you could store all the special characters in a single file, extracting them as needed, rather than having a separate file for each character.  

(2) You can define string variables within a macro, consisting of multiple bytes, without using an external file at all.  For example, see below the loading of the two-byte carriage-return-line-feed sequence into string variable T94.  Obviously you would be building Unicode sequences, not these particular sequences.  If your macro then puts the string variable into the clipboard and pastes it to the library application, will that work???  

// Tab character ascii 9
Variable Set %T91% to ASCII Char of 9
// Line Feed character ascii 10
Variable Set %T92% to ASCII Char of 10
// Carriage Return character ascii 13
Variable Set %T93% to ASCII Char of 13
// Carriage Return / Line Feed combination characters ascii 13 + ascii 10
Variable Set %T94% to ASCII Char of 13
Variable Modify String: Append %T92% to %T94%

Edited by rberq
Link to comment
Share on other sites

MEP is not capable of Unicode. You could copy things from your clipboard from and application to an application, but if you read the text in, it will be converted to ACSII/ANSI. 

I could probably make a simple application for you to do this. I can imagine it working as a helper for MEP. If your'e interested, send me a PM and I'll see what I can do. 

Link to comment
Share on other sites

Bear in mind data is a series of bytes and it's up to the program to decode it. There are different flavors of Unicode but Word is likely the UTF16 and is 16 bytes where ASCII/ANSI is 8. So it will chunk though it and break each in half and you will have seemingly random characters. But much of Unicode will have the same first 8 bytes for the same letter, say "A". So one can chunk though it by deleting every other character. And some, like UTF8 are only 8 wide for basic characters but 16 for extended. So in those cases much of it will still be legible when using the ASCII code page. 

Link to comment
Share on other sites

Thank you! The Heximadecimal option worked! (Although using it in this particular application has an odd side-effect that it also triggers one of the drop-down menus, but if I add an ESC key right after the heximadecimal character in the macro the menu disappears again pretty quickly. Klugey, but I can live with that for the moment and hope to figure a better way to deal with it once I've played with it.)

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...