ImagingTips.com

Editing G11 Keyboard Macros

by Wren McMains

As we saw on the previous "page", it's easy to rename macros and reassign them to other keys using the Logitech Profiler. Logitech also let's you delete keystrokes and/or delays from macros you've already recorded, but that's about all. But, don't despair. It's easy to edit your macros using your favorite text editor.

The first step is to select the profile you want to edit from the Current Profile pull-down:

x

Then from the Profiler menu, select "Profile / Export ...":

x

If the menu looks like this:

x

click on "Browse Folders" and the menu will change to something like this:

x

I recommend creating a folder (somewhere in your "Documents" tree which you backup regularly). You see above that I've created a folder named "G-Keyboards" where keep my keyboard profiles. By default the file name (second arrow above) it assigns the profile matches the name of the profile; I use the default name when saving my profiles.

Now you can open the profile with your favorite text editor (Notepad or Wordpad will work, personally I use NoteTab Pro because it's programmable).

However, before you do this there are some things to be aware of. Much of the keyboard profile is stored somewhere (I assumed in the registry, but couldn't find it there, it's probably just inside the Profiler). When the Profiler tries to import a .LGP file, say "Default Configuration.lgp" we just exported, if structure doesn't match the stored definition exactly the whole .LGP file and any changes you make seem to be ignored.

The only thing I've been able to successfully edit in the .LGP file are the keystrokes produced by a macro. It's been my experience that can't change the name of a macro, add keystrokes to a macro for which you have not previously recorded keystrokes, delete macros, or do anything else to the .LGP file. Therefore, don't try renaming the macros or changing the key assignments using the text editor, do that using the techniques described in renaming macros and reassigning them to other keys.)

My default keyboard in Mode 3 currently looks like this:

x

You'll note that I have several macros defined. If I press the G1 key it will type my name. The G13 and G14 macros type sentences you learned if you ever took a typing class. The G16 macro types the first paragraph of the Gettysburg Address. I want the G17 and G18 macros to type the second and third paragraphs, but all I did was attach the macros to these keys and record a couple of random characters for each. Remember, I warned you that you can only edit macros that you have already recorded, so be sure you've first recorded something for each one using the Profiler.

When I open the "Default Configuration.lgp" file I just saved using my favorite text editor I see (word wrap is turned off so you don't see all of any long lines):

x

Next I scroll down looking for the macro I want to edit. But, first let's stop at the definition of the Gettysburg1 macro which starts like this:

x

Notice that definition is made up of lots of events (for this single paragraph, there are 382 events). The first event is to press the shift key down (in fact the left shift key). The next event is to press the "F" key down (which gives us an upper case F since a shift key is down). The next event is to release the "F" key (keyup). Then release the left shift key. Then press the "O" key (but now because no shift key is down, it will be a lower case O. Etc., etc., etc.

You'll also notice I've added a delay of three-tenths of a second after each word just for the fun of it ... this makes it easier to read as you see it typed into a text document. Delays are measured in thousands of second, so 300 is 0.3 seconds. A delay of 3000 would be a 3 second delay.

OK, now let's scroll down to the Gettysburg2 macro which I want to change:

x

You'll notice that all I recorded for this macro was a couple of X's, however, I had delay turned on while recording so you see it took me 93/1000's of a second to release the X key after I pressed it. Then it took me over half a second to press it again (653/1000's of a second to be exact).

You'll also notice that for the Gettysburg3 macro, all I recorded is a single character, the letter x, but this time I un-checked the "Record Delays" box. The "Now is ..." macro is the "Now is the time for all good men ..." sentence that I learned in typing class about 50 years ago.

Another thing you'll notice above is that certain keys have special names, in the example above: LSHIFT and SPACEBAR. The letter keys are denoted by the corresponding capitol letter, but all the other keys except the number keys above the letters keys have special names. (Even the number keys on the number keypad have special names.) I've created a list of all these special names that you can print, but I had to develop this list by experimentation so let me know if I missed anything.

Note:  although what follows shows copying large amounts of text, you
can use the same technique to make simple edits to your macros.

I went to Wikipedia on the internet, looked up the Gettysburg Address, copied the text of the Address and pasted it into another file. Then I used some of the search and replace and other programmable features of my text editor to make it look like the macro definition. Here's the start of the second paragraph:

x

One thing you should note above is that the indents and other spacings are ignored. Unlike the macro file I'm editing, my lines have no indents except that I indented the spaces between words just to give me a chance when read the text.

I then selected all the keystrokes for the second paragraph of the Address and copied them onto the clipboard. Then I went back to the "Default Configuration" file and selected the recorded keystrokes:

x

And replaced that text with what I just copied to the clipboard. Obviously I could also do the same for the third paragraph, but I've found it's too easy to make a mistake and have everything rejected (ignored). Therefore, I've learned to make edits in small steps. First I'll save the "Default Configuration.lgp" file with these edits and try to import it:

x

With luck, it will bring you back to the folder where you saved the exported file. Click on the file:

x

This will fill in the name of the file on the "File name" line, then click Open:

x

Verify that the new macro definition has been loaded by testing out the key or looking at the definition in the Profiler by choosing "Edit / Macro Manager ..."

x

And reviewing the definition of the macro you just edited:

x

Here you see the new definition has been loaded ... it's no longer defined as a couple of X's. However, if the definition hasn't changed it means there was an error in your new macro definition. Maybe you didn't use one of the special characters where you needed to. When this happens all you can do is make a smaller change ... maybe only insert part of the new definition. If that works you know the error is in the second half of your new definition ... keep adding or subtracting from the new definition until you locate the problem.

One thing I've noticed is that the Profiler doesn't seem happy with lots of long macros (like these paragraphs, each of which has 400 to 1000 events). They work, but it takes the Profiler a long time to display them ... my guess is that if I keep adding lots of them I may exceed the capabilities of the software associated with this keyboard. (I just used Task Manager to look at the memory the Profiler was using. It's about 25MB, but that's nothing compared to the 244MB Bridge is using or the 360MB the Photoshop is using.)

E-mail me if you have a need for a program to turn text into keyboard macros. Until I find more of a need, I have no plans to finish the work I started on one.

Suggested next choices:

ImagingTips.com Site Map