Jump to content
Macro Express Forums


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by acantor

  1. Scripts not recognized in Word 2016

    Running Macro Express as an Administrator worked!
  2. I am developing Macro Express Pro scripts to run in Microsoft Word on a Windows 10 machine. Although the scope of my scripts are set to Global, my hotkey and shortkey macros are not activating while I am in Word. The scripts are activating fine in every other program. Changing the scope to Word doesn't help. Any thoughts on what might be blocking scripts from activating while I am in Word?
  3. Scripts not recognized in Word 2016

    Update 1: I thought this might be a Microsoft Office issue, but the macros work fine in PowerPoint. Update 2: When the Macro Express hotkey is the same as a Word hotkey, the Word hotkey works. Usually the opposite is true: Windows "sees" Macro Express hotkeys first. Samrae, I will try your suggestion.
  4. Tips for beginners

    I have taught many hands-on Macro Express courses, but none are currently scheduled. Most courses were hosted by my professional association, RESNA, and took place at its annual conference. So your best option to learn Macro Express is to apply the dual strategy used by many on this forum: 1. Learn Macro Express through trial-and-error experimentation. 2. Don't hesitate to ask questions on this forum! There are no shortcuts to learning a program like Macro Express. It's a sophisticated tool – it takes time and effort to get a handle on its complexities. Fortunately, the Help screens in Macro Express are actually helpful… perhaps the best of all of the scripting tools.
  5. You can do it with Macro Express Pro (or Macro Express 3) if you are content with a non-programmatic solution. Text Type (Simulate Keystrokes): <ALT>d // Go to address bar. Normally, it's selected by default Clipboard Copy Variable Set String %Address% from the clipboard contents
  6. Wait for Text Playback - does it work?

    I have never used it. But I have experimented with similar constructs in VB-like languages and in AutoHotkey, and I'm not sure that I can tell the difference. In Dragon Advanced Scripting, for example, I can do this with the SendKeys statement: SendKeys "Hello, World" or this: SendKeys "Hello, World", True The "True" argument is supposed to ensure that keystrokes are completely processed before the statement returns control to the procedure. I am not positive adding the argument makes a difference, or at least, a difference that is noticeable enough to enhance reliability. So what I often do is add a short delay: SendKeys "Hello, World" Wait 0.1 If the lack of a delay causes a Macro Express script to go wonky, I do exactly the same thing: Text Type (Simulate Keystrokes): Hello, World Delay: 100 milliseconds
  7. I am scripting a macro that presses the down arrow key %x% times, where x is between 1 and 1300. In some scripting languages I can repeat a key press %x% times: <DOWN %x%> Is there a way to do this in Macro Express? Or should I make peace with repeating %x% times? Repeat with Variable: Repeat %x% times Text Type (Simulate Keystrokes): <ARROW DOWN> End Repeat Thanks!
  8. That's exactly how it works. I'm not sure how long I will be able to use this technique, as I've noticed that drop-down lists in Windows 10 are less likely to support incremental searches. Which is really unfortunate. It's a very speedy way to manually navigate to a target on a long list. It works when typing, and especially, it works when automating via macros. There is no way that I would have been able to make it work for the items that are 32 characters long if I had to type them manually. (The way that Microsoft implemented the incremental search, you cannot pause while typing. A pause of a fraction of a second resets the search.) The macro now executes more slowly. I had to add an IF statement within the repeat loop to check for one special case. There is an issue with one item on the list that causes the incremental search to fail. The extra test noticeably slows down the macro. However, that's the trade-off I needed to make so the macro run reliably from start to finish. Nevertheless, the development time for this macro, plus the extra five or ten minutes it takes to run it, still represents a tiny proportion of the mental and physical effort I would have expended to perform the task manually.
  9. Well, I actually considered your approach! It think it's workable, although it would be a pain to code. I might try it one day just to see if I can. But I found an alternative way to solve the problem that reduced the number of simulated keystrokes by a significant amount, maybe by a factor of 50 or 100. Instead of pressing down arrow keys, I now do incremental searches on the drop down list to navigate to the item I want. So to navigate to the 1000th item on the list, instead of pressing down arrow 1000 times, the macro types its name exactly how it appears. The length of the item names vary between three and 32 characters. So to reach the 1000th item, I only need to send as many characters are in its name.
  10. It's not really a problem, except, perhaps, of aesthetics! <Down %x%> is neater than a repeat loop. But I will get used to it! The macro extracts every item from a 1300-item long drop-down list. To navigate to all of list items, the macro needs to press the down arrow key over 800,000 times: 1 + 2 + 3 ... + 1300. It runs in about 15 minutes. I can't imagine how long the task would have taken had I done it manually, but I know I only spent 60 or 90 minutes scripting and debugging the MEX macro. Thank you, Insight Software Solutions, you saved me days (possibly weeks) of mind-numbing boring effort, as well as significant upper body wear-and-tear!
  11. Glad to be able to help. If you can script something as complex as nested IF-THEN-ELSE statements, you can probably wrap your mind around SWITCH / CASE statements. The Macro Express Help on the topic is excellent. There may be times when SWITCH / CASE statements make for the cleanest code, but much depends on the number of cases. Sometimes I opt for IF-THEN-ELSE when there are not too many. Judiciously adding white spaces between blocks of code (i.e., blank Comment statements) can help add clarity to what would otherwise be convoluted code!
  12. Try something like this. The script tests whether the integer variable contains 01 and 99: Variable Set Integer %Value%: Prompt If Variable %Value% Contains "01" AND If Variable %Value% Contains "99" Text Box Display: Yes, %Value% contains "01" and "99" Else Text Box Display: No, %Value% does NOT contain "01" and "99" End If
  13. Saving to Excel in background

    A VBA macro might be the ticket. Try recording the procedure using Excel's macro recorder, and then modify the code to create a more general solution. The folks on various Excel VBA help forums might be able to provide assistance.
  14. This approach solved a dropped character problem when I was creating ME macros for an Java application: In the Control Panel, go to Keyboard Properties, and reduce the repeat rate. Setting the value to 25% or 30% was enough to prevent characters from dropping when I sent input via Text Type.
  15. Fill multiple choice menu with macro

    It sounds do-able with Macro Express, but it would be helpful if you would provide more details.
  16. Rename Folder Error

    Try adding a delay between the two rename commands. Start with three or five seconds. If that proves to be the source of the problem, then incrementally reduce the time until it fails again. Then bump up the delay slightly.
  17. If you created the macro by capturing your actions, the resulting script is likely extremely long. If it's sufficiently lengthy, the script will take time to execute. And while it's executing, you will be effectively prevented from doing anything else with your computer. There are many advantages of keyboard input over mouse input when automating repetitive tasks via macros: First, the number of keystrokes is significantly fewer than the number of mouse movements. Dozens, hundreds, or thousands of mouse movements can sometimes be replaced with one or two keypresses. For example, if you record yourself selecting an entire webpage by scrolling to the top, clicking in front of the first word, and dragging down to the end of the page, the capture can conceivably be a thousand lines long. But the same action can be accomplished by pressing a single keystroke: Ctrl + A. Second, a script consisting of keystrokes is more likely to work reliably. A recorded macro consisting of mouse actions may not work as expected if you change the zoom level in your browser or resize the window. Nor is your macro guaranteed to work if the web developers change a page's styles (e.g., typefaces, font sizes) or add or subtract content from the page. On the other hand, the hotkey for selecting an entire webpage will always work – at least, as long as a form element does not have keyboard input focus. Ultimately, if the macro is taking so long to execute that you are unable to do anything else, it's worthwhile rewriting the macro so that the task is performed via keyboard. If your computer is locked for a long time while your mouse-intensive macro is running, know that simulating the keystrokes won't prevent the macro from locking up your computer, but it will probably only do so for a fraction of a second.
  18. Could you describe in detail what are you trying to accomplish? If you are using Macro Express's capture feature, be aware that playing back a script may not give you the results you are looking for. A captured macro may not play back correctly when run in a different window. As a general macro scripting rule, I suggest avoiding mouse actions unless there are no alternatives. In browsers, there are ways to navigate, select, copy, and paste without the mouse. The ease of performing these actions sans mouse, however, depends on the browser and your browser settings. When dealing with web content, I find Firefox easier to work with than Internet Explorer or Chrome.
  19. Excel: macro fails consistently

    Hi Terry, I recently completed a project of automating aspects of Excel using a different scripting tool (i.e., not Macro Express). For the first part of the project, the client's PC was running Windows 7. For the second part, the PC was a Windows 10 machine. A handful of scripts that worked beautifully under Windows 7 failed under Windows 10. So it would appear Microsoft has thrown curveballs to those of us who use third-party scripting tools. In every case I found workarounds; but the workarounds were not always elegant. In your situation, the next thing to try is alternative ways to copy the field. For example, instead of sending Ctrl + C, try copying the text via the context menu. Or cut the email address, pause for half a second, and paste (which will allow you to see whether the clipboard operation was successful.) Or just cut it, and forget about pasting it back. Or substitute Macro Express's clipboard commands when copying and pasting instead of Ctrl + C and Ctrl + X; or vice versa. If none of these approaches are successful, I would delete the macro and re-create it from scratch. On second thought, I would do this next! And if you are still not successful, report the problem to the good people at Insight Software. This may be a Windows 10 compatibility issue.
  20. Excel: macro fails consistently

    I am using Windows 7, not 10, and Excel 2007, and not something newer. So things may be a little different on my computer. A few thoughts: 1. Try <Ctrl>k to open the hypertext link instead of opening it via the context menu. 2. I need to select the email address from the Edit Hypertext dialog box: <Ctrl>a should work, but so should <Home><Shift><End>. 3. Instead of opening the hypertext link, try editing the cell, something like this... <F2> <Home><Shift><End> <Ctrl>c 4. How about copying the cell directly, without editing it? <ARROW UP><ARROW RIGHT> // navigate to a cell <Ctrl>c
  21. I think the Windows desktop is overrated. It's visually busy, hard to keep organized, and challenging to navigate around sans mouse. At various times I have preferred instead to open the desktop as a folder in Windows Explorer: I find it easier to deal with files and folders when they are listed alphabetically, which is easy to do when viewing the desktop as a regular Windows folder:
  22. Terry, Win+M is a legacy hotkey leftover from Windows 95 or 98. Microsoft introduced Win+D (D for desktop) years ago, and I have generally found it a little more reliable than the old hotkey. The following key sequence, which has also been around since Windows 95, minimizes all windows; but in Windows 7 and beyond, I am not sure it reliably puts focus on the desktop. But it does lend itself to scripting... Ctrl + Esc ' Activate Start/Windows button Esc ' Cancel Start button, but leave it focused Alt + M ' Minimize all A related key sequence makes it possible to interact with items on the desktop without actually minimizing any windows. So interaction with desktop items is hidden behind the open windows. For example, to navigate to and activate a desktop icon called "Terry"... Ctrl + Esc ' Activate Start/Windows button Esc ' Cancel Start button, but leave it focused Shift + Tab ' Navigate to the desktop Terry <Enter> ' Incremental search to Terry, and press Enter to activate it.
  23. To expand on Bruce's excellent explanation... There is no (easy) way to move the mouse pointer to selected text. But experiment with Chrome to find out whether it supports standard Windows hotkeys for selecting text once you have zeroed in the text using the Find command, e.g.: Shift + right arrow (select one character to the right) Shift + Ctrl + right arrow (select one word to the right) Shift + Home (select to the start of the line) Shift + End (select to the end of the line) This is a partial list of hotkeys for selection within a webpage. There are others, pretty well all of which involve holding down the Shift key. With Chrome, you may need to press F7 to enable selection via keyboard. It's a toggle (it's either ON or OFF) so you may need to turn it off once you're done selecting text, e.g., F7, Shift + Ctrl + Right, F7. Overall, I find Firefox more versatile than Chrome -- and much more versatile than Internet Explorer -- when I am scripting macros that select text on a webpage.
  24. Editing the contents of a string

    I use Variable Modify String commands a lot to revise texts. For example: Text Type (Simulate Keystrokes): <CONTROL>a // Select all Clipboard Copy Variable Set String %Clip% from the clipboard contents Variable Modify String %Clip%: Strip CR/LF // Delete all new lines Variable Modify String: Replace " " in %Clip% with " " // Replace double spaces for single spaces Variable Modify String %Clip%: Lowercase // Lowercase everything Variable Modify String: Replace "color" in %Clip% with "colour" // Change the spelling of words that contain "color" and "labor" Variable Modify String: Replace "labor" in %Clip% with "labour" Text Type (Simulate Keystrokes): %Clip% // Replace the selection with the revised text
  25. Although the code is (mostly) unintelligible to me, I did have a few concerns that might account for the inability to interact with the screen elements via keyboard: Interaction via keyboard is improved by relying on "onfocus" instead of "onclick" events. A modal dialog is a secondary window that opens in front of the main window. For example, when you close a word processing document without having saved it, the program pops up a window asking you if you want to save the document. You must interact with the dialog box before you return to main window. In Windows, standard dialog boxes are keyboard accessible by default. In web apps, dialog boxes can be keyboard accessible, but it's up to the developer to ensure keyboard interactivity. There are no accesskey attributes in the code sample. Developers can provide mechanisms for interacting via keyboard by incorporating access keys. In the above example, a user would be able to go to the home page by pressing Alt + h (in Internet Explorer and Chrome) or Shift + Alt + h (in Firefox). In Chrome, the access key is either Alt + h or Shift+ Alt + h, depending on the circumstances.