Jump to content
Macro Express Forums

Text Type of <Alt> works unexpected

Recommended Posts

if there's a command in a script: "Text Type (Simulate Keystrokes) <ALT>", it doesnt work as expected.

It seems as if it has been realized something like

  • if <ALT> is typed, there will follow at least 1 character to complete a command
    • If at least 1 character (or number or something) follows: simulate keydown <ALT>, simulate following character(s), simulate keyup <ALT>
    • If NO character (or number or something) follows (means only to simulate <TAB>): simulate nothing
      and wait for next character to type (simulate) and then simulate keydown <ALT>, simulate following character(s), simulate keyup <ALT>

With this behavior, there's a general problem with some Applications (i.e. Outlook 2016):

I need to press (down and up) <ALT>, that means <ALT>, and nothing else! to activate, that outlook can be controlled by keyboard. That doesn't work in ME.


So i can't automate "lock sender" (because of spam).


Link to comment
Share on other sites

I need to press (down and up) <ALT>, that means <ALT>, and nothing else

I find <ALT> often does not work, specifically with Office programs. I generally use <ALTD> and <ALTU> instead. Have you tried

Text Type (Simulate Keystrokes): <ALTD><ALTU>

Outlook may even want a small delay in between:

Text Type (Simulate Keystrokes): <ALTD>
Delay: 0.05 seconds
Text Type (Simulate Keystrokes): <ALTU>

or this

Keystroke Speed: 30 milliseconds
Text Type (Simulate Keystrokes): <ALTD><ALTU>
Keystroke Speed: 0 milliseconds

Link to comment
Share on other sites

I have rarely found a reason to use <ALTD> and <ALTU>. I find <ALT> works fine as a modifier key.


<ALT> by itself moves focus from the active window to the menu bar, or, if the application uses ribbons, to the ribbon. Little known factoid: <F10> does exactly the same thing.


So to activate the File menu:




(You must use lowercase f; <ALT>F is equivalent to <ALT><SHIFT>f, which in some applications does nothing; but in some applications it is a hotkey. For example, in Word, <ALT><SHIFT>f changes the style to "Footnote Text Style")


Similarly, to activate the Home ribbon:




In Macro Express, there are several ways to code these kinds of key sequences:


Text Type (Simulate Keystrokes): <ALT>h // Easiest way



Text Type (Simulate Keystrokes): <ALT> // First, move focus to the ribbon

Text Type (Simulate Keystrokes): h // Then, activate the Home ribbon




Text Type (Simulate Keystrokes): <ALTD>h<ALTU> // This is overkill in my view!


For standard Windows hotkeys like Alt+F4 and Alt+spacebar, these work nicely:


Text Type (Simulate Keystrokes): <ALT><F4> // Close this window
Text Type (Simulate Keystrokes): <ALT><SPACE> // Activate the System menu for this window

Link to comment
Share on other sites

I think frameingreen is using Alt to toggle the ribbon menu shortcuts on.


Frameingreen you might look for an existing keyboard shortcut in your application. EG Ctrl+P to print. You can find several lists online.

Link to comment
Share on other sites

If it's a command on a ribbon in an Office product that you want to access, and there is no default hotkey for the command, I find this approach works nicely. In this example, I am automating "Paste Special" in Word. You may need to a short delay between the first and second lines to make it reliable.


Text Type (Simulate Keystrokes): <ALT>h // Home ribbon

Text Type (Simulate Keystrokes): v // Paste

Text Type (Simulate Keystrokes): s // Paste Special...

Text Type (Simulate Keystrokes): Unf // Select "unformatted" from the listview (only the first few letters are needed)

Text Type (Simulate Keystrokes): <Enter> // Activate the default button (OK)

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