Macro Express News

December 9, 2013

This is the online edition of the Macro Express News email newsletter. You can have future editions delivered directly to your email inbox. Visit the Macro Express News page to subscribe or to view past issues.

Macro Express Pro v 4.5.0.1

Macro Express Pro v 4.5.0.1 is now available from www.macros.com/download. This release of Macro Express Pro contains many enhancements and bug fixes including:

  • Added ability to hold a key down.
  • Enhanced the Alt-Key Sequence feature to allow Unicode characters to be typed using Alt Key Code hexadecimal values. More information
  • Includes many changes to make Macro Express Pro more stable with fewer crashes.
  • A change was made to fix a problem that would cause Windows to slow down when certain programs were running along with Macro Express Pro.
  • Fixed a problem where some housekeeping tasks that should only occur once were performed repeatedly if the license was entered via the advanced installation options.
  • Added Windows 8.1 and Windows Server 2012 R2 to the ‘Get OS Version String’ and ‘If OS Version’ commands.
  • The Mouse Locator has been upgraded to improve getting the color of a pixel color from the screen.
  • Shortkey activation improvements
  • Updated macros in samples.mex to be compatible with newer versions of Windows, to be more reliable, added new sample macros along with new Macro Express Pro helper macros.
  • Fixed problems with monthly Scheduled macros.
  • Made a change to improve the reliability running a scheduled macro set to run when the computer is idle.

A complete list of changes is available on the Revision History pages.

Tip: Run a program as a non-administrator when Macro Express is running as administrator

Previous issues of the Macro Express News discuss how to run Macro Express as an administrator. One side effect of doing this is that programs that are launched from a macro also run as administrator. This can have unwanted side effects. Customer John Greiner found a solution:

“I figured out how to run a task not as admin even when ME Pro is running as admin”, he said. This sample will launch Outlook 2007. Change the “ProgramToRun” variable to the program you want to launch:

Variable Set String %ProgramToRun% to “C:\Program Files (x86)\Microsoft Office\Office12\Outlook.EXE”

Program Launch: “runas.exe” (Normal)
Parameters: /savecred /user:”<login name>” “%ProgramToRun%”
Delay: 0.5 seconds

If Window “runas.exe” is focused
Encrypted Text: Type out the text // Account Password
Delay: 50 milliseconds
Text Type (Simulate Keystrokes): <ENTER>
End If

Notes:

  • The account you are using to run runas from must have a password.
  • It is fine to run runas from the same task that you are currently logged into.
  • The account password (contained in the encrypted text command) is only needed the first time the runas is executed after a reboot. That is why there is a small delay after the wait for window. The delay may need to be longer than I am showing for a slower computer.

“I hope some other users find this useful!”

John Greiner
www.themacroexpert.com

Hold a key down

Some applications require a key to be held down while performing some other action. It might, for example, have the ‘g’ key held down while typing other letters. Macro Express has always had options in the Text Type command to hold down the modifier keys such as ALT, CTRL, SHIFT and the Windows key. Macro Express Pro v 4.5.0.1 introduces the ability to hold nearly any key down.

To do this include <KEYD:x> as part of a Text Type command where x is the key to be held down. For example, enter <KEYD:q> to hold down the “q” key. Enter <KEYU:q> to release the key when needed. Similarly, insert <KEYD:Q> to hold down the “Q” key and <KEYU:Q> to release it.

Sample macros - samples.mex

When Macro Express is installed, a copy of the macro file samples.mex is also installed. This macro file contains sample macros that demonstrate many of the features in Macro Express. You can study these macros to learn how to use specific macro commands in your own macros.

Download Macro Express Pro sample macros here and Macro Express 3 sample macros here.

When the samples.mex macro file is loaded into Macro Express the ‘Menu of Sample Macros’ macro should automatically run. This scheduled macro displays a menu of the available sample macros. Click next to one of the macros and click the OK button to run it. You may also run individual macros from within the Macro Explorer.

These new sample macros have been added to samples.mex for Macro Express Pro:

New sample macros for Macro Express Pro

Date Time MathThis macro demonstrates some of the Date/Time features
Show Macro ProgressUse the Text Box Display command to show progress as a macro runs
Split and Combine StringsSplit a string variable into an array variable. Later combine an array variable into a single string variable
Type Special CharactersDemonstrates how to use the Alt-Key sequence command to enter symbols or Unicode characters into your macro
Restart Macro ExpressRestart Macro Express each day to improve stability
Pixel Color Hexadecimal from Mouse LocatorType a pixel color saved by the Mouse Locator into another program in hexadecimal format
Pixel Color Red, Green, Blue from Mouse LocatorType a pixel color saved by the Mouse Locator into another program as Red, Green and Blue integer values

Note: We do not recommend that you put your macros in the sample.mex macro file.

Unicode and other characters using the Alt-Key Sequence feature

The Alt-Key Sequence is a method of inserting symbols that may not be present on your keyboard, such as á, Ô, ©, ¾ or ¿ into Windows applications. This can be done manually by holding the ALT key down and pressing digits on the numeric keypad. Alt-Key Sequences can be added to your macro by clicking on the “Symbols” button in the “Text Type” command and then clicking the “Alt-Key Sequence” button.

There are three ways to enter special characters using the Alt-Key sequence: the legacy method, the newer leading 0 method and latest hex method. The hex method can be used to enter Unicode characters. The Alt-Key Sequence feature in Macro Express Pro v 4.5.0.1 has been enhanced to support all three methods.

The “Type Special Characters” macro contained in samples.mex for Macro Express Pro demonstrates how to type Alt-Key Sequences.

Pixel colors via the Mouse Locator

The Mouse Locator tool displays the position of the mouse cursor relative to the screen and relative to the active program. This information is useful when writing macros using mouse move and mouse click commands. The Mouse Locator tool can be loaded by clicking Tools, Mouse Locator.

The Mouse Locator also displays the color of the pixel under the mouse. This is helpful when writing macros that use the Get Pixel Color command to take different actions depending on a pixel color. One example of such a macro would be to detect when a progress bar reaches a specific point.

Although Macro Express Pro uses integer values for colors, many other programs use RGB or hexadecimal values. The Mouse Locator program can be useful when determining colors to be used in these programs. The Mouse Locator program for Macro Express Pro has been updated to display colors in several formats: as an integer, as a hexadecimal BGR value, as separate integer values for Red, Green and Blue (RGB) and as a hexadecimal RGB value.

As another convenience, when the Mouse Locator has focus, you can press Ctrl+C to copy the color values to the clipboard. The Macro Express helper macros included in the samples.mex include macros that can then be used to type colors into other programs.

For example, to set a color in Word requires that you type integer values for R, G and B. You can use the Mouse Locator to move the mouse over a color on your screen, press Ctrl+C to copy the color values to the clipboard. Then click in the R: field in word and press Ctrl+Shift+R to type the color values into Word.