Jump to content
Macro Express Forums

Is there a way to automatically assign hotkeys to selected text?


cden
 Share

Recommended Posts

First of all, this is by far the best Macro Program i have tried, mainly for one reason: This program has a section with a big text area that basically says, "whatever you want in you macro, put it here". No other program does that (you have to actually TYPE the stuff you want to program it...horrifying when programming entire paragraphs). I also like that the program will put the text onto the clipboard first, then paste it where you want it. MUCH faster than replaying keystrokes.

 

Anyway, here's what i'm trying to do:

 

I want to be able to select a block of text, press a hotkey, and that selected text is now on the clipboard for THAT HOTKEY ONLY.

 

So for example, if i select a block of text, and press ALT+WIN+G, that text will be saved to the G hotkey, which i can then paste with CTRL+WIN+G.

If i select a block of text, and press ALT+WIN+H, that text will be saved to the H hotkey, which i can then paste with CTRL+WIN+H.

 

And so on for every letter, and possibly the numbers, symbols, function keys, and number pad.

What is the most efficient way of doing this? I'm good with programming simple text things using the Editor, but i can't figure out how to get a block of text to save to the program with a hotkey.

 

EDIT: Did some searching. Would it be something like this?

 

 // <<< Do something to highlight the first piece of information >>>
// Copy it to the clipboard
Text Type: <WIND><ALTD>g<ALTU><WINDU>
// Copy it to the clipboard
Variable Set String %T1% from Clipboard

 

To be honest, i don't where that would even go. But maybe it's on the right track.

 

Do i need the ALTU and WINU parts? The real Windows Clipboard does not require you to release the CTRL key to copy/paste. It's much more efficient to hold the CTRL key and press the other keys.

Link to comment
Share on other sites

Did some more searching, and found this reply:

 

Have you tried copying the text immediately from the clipboard into a variable? Then the restore command could restore it from the variable, rather than worry what the clipboard had been changed to.

 

The macro at Ctl-1 woud copy the text to the clipboard, then save it to variable T1, and the Alt-1 macro would type the contents of variable T1, regardless of what had happened to the clipboard in the meanwhile.

 

Seems logical, except i have no idea how to implement this, or where i would place this information. Sorry about sounding like such a noob, but i'm trying to figure this out on my own until someone is able to help.

Link to comment
Share on other sites

Figured it out myself. The way i figured it out involves having to create two macros for every letter on the keyboard (one to copy and one to paste), but it's the only way i can get it to work the way i want for now. Thanks anyway...

 

Hi,

 

I've attached a playable macro for you to try. Import it into Macro Express and set the activation to Ctrl+Alt+A. Have a look at the workings before you activate it.

 

The macro should copy highlighted text when activated. It will then flash up a box to show you what it has captured, save the text to a .txt file (in a folder called 'Saved Text' in the root of C) and empty the clipboard.

 

The next time you activate it, if no text is found for the clipboard to copy, it will type out the contents of the saved .txt file. If there is something for the clipboard to copy, the .txt file will be overwritten with the new information.

 

I've only tested this in a MS Word document. It works ok but you might find that some other programs will interfere with the process.

 

I hope this gives you something to develop further. You might also want to add a 'Clear Clipboard' command right at the start of the macro.

 

Regards

 

Rick

Copy_and_save_text.mxe

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.

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

Loading...
 Share

×
×
  • Create New...