Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,531
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. Macro Express may not be able to "see" anything in the VPN client. You might try activating the VPN window via Macro Express to give it focus, and then clicking a coordinate relative the window. Also try activating the menus in the VPN by keyboard. You might be able to send keystrokes with Macro Express once the window is focused. Try <ALT> + the underlined letter to access a menu, e.g., Alt+F for the "File" menu. If you cannot fully automate the process, partial automation is a fine option. For example, you may need to manually give focus to the VPN region before activating a macro that does the repetitive grunge work.
  2. Copying and pasting between cells and worksheets are not tasks that I usually automate. But if I did, I would make use of built in hotkeys in Excel, e.g., F2 (to edit the current cell); Ctrl + PageUp/PageDown (to flip to the next/previous worksheet), Ctrl + spacebar (to select the entire column), and so on. My favourite Macro Express script for Excel moves an entire row down or up without selecting it, analogous to the two built-in Word commands that move an entire paragraph, without the need to select it first. My scripts assume the same shortcuts for both programs: Alt + Shift + Up/Down. Move Row Up: (Alt + Shift + Up) {Set to activate as soon as the keys are pressed} Lock Keyboard and Mouse Text Type (Simulate Keystrokes): <SHIFTU><ALTU> Text Type (Simulate Keystrokes): <HOME> Text Type (Simulate Keystrokes): <SHIFT><SPACE> Text Type (Simulate Keystrokes): <CONTROL>x Text Type (Simulate Keystrokes): <ARROW UP> Text Type (Simulate Keystrokes): <SHIFT><CONTROL>= Text Type (Simulate Keystrokes): <SHIFTD><ALTD> Unlock Keyboard and Mouse Move Row Down: (Alt + Shift + Down) {Set to activate as soon as the keys are pressed} <LOCK KEYBOARD AND MOUSE/> <TEXT TYPE Action="0" Text="<SHIFTU><ALTU>"/> <TEXT TYPE Action="0" Text="<HOME>"/> <TEXT TYPE Action="0" Text="<SHIFT><SPACE>"/> <TEXT TYPE Action="0" Text="<CONTROL>x"/> <TEXT TYPE Action="0" Text="<ARROW DOWN><ARROW DOWN>"/> <TEXT TYPE Action="0" Text="<SHIFT><CONTROL>="/> <TEXT TYPE Action="0" Text="<SHIFTD><ALTD>"/> <UNLOCK KEYBOARD AND MOUSE/>
  3. Hi Terry, I have had good luck with the Alt+F8 method for running VBA scripts from Macro Express. You are correct, there is no need for such long delays. 10 ms should be enough, and no delay may work fine.
  4. Try saving the control using its "coordinates" (instead of its "z-order.")
  5. 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)
  6. 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: <ALT>f (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: <ALT>h In Macro Express, there are several ways to code these kinds of key sequences: Text Type (Simulate Keystrokes): <ALT>h // Easiest way or Text Type (Simulate Keystrokes): <ALT> // First, move focus to the ribbon Text Type (Simulate Keystrokes): h // Then, activate the Home ribbon or 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
  7. Congratulations. Your script looks good! And it doesn't seem to need delays to make it run reliably. (Although in the fullness of time, you may discover the script will benefit from time "shims" to maximize reliability.) Told you so!
  8. I was also thinking that an elegant and reliable solution might be possible using controls. Learning to deal with Windows controls is not particularly easy; I have been using Macro Express since 1999 (perhaps earlier), and I am still figuring out how to automate tasks via controls. The tutorial that Cory referred to you is a good introduction. I have found that when capturing a control that appears in a window that has a changing title, choose the option to "save the control using its coordinates."
  9. It's possible, but the project could turn into a major scripting job. Automatically detecting a screen update might be trivially simple, horrifically complex, or impossible. You won't know which until you try. I can almost guarantee it's going to take significant amount of trial and error experimentation. A simpler approach might be to semi-automate the task. Instead of automatically detecting a screen event, start the process manually by pressing and releasing a hotkey, typing one or two characters, or clicking the mouse on part of the UI. Sounds like a fun project for someone who derives pleasure from writing macros (which is almost everybody on this forum!)
  10. Some of the latest Adobe products do not support proper keyboard interaction. Trying to interact via macros is similarly compromised.
  11. When hovering the mouse pointer causes a colour change, I check the pixel colour at (x, y) rather than under the pointer. Get Pixel Color at (100, 399) Relative to Current Window into %PixelColour% The challenge is determining the colour when the act of hovering causes the colour to change. My workaround: take a screenshot, paste the screenshot into Paint, and use MEP's Mouse Locator tool to check the colour in Paint.
  12. As I mentioned, I don't have Windows 10, but there must be a way to navigate to the Desktop list via keyboard. Maybe something like this? Windows + B (to place focus on the System Tray) Shift + Tab (once or twice, to move focus from the System Tray to the Desktop list)
  13. Glad to be of help, Terry. This example demonstrates the usefulness of MEP's "Get Control" feature. I recently figured out how to use the feature to grab information from a window, even if its title changes, or if it is running in the background. Here are the "tricks" to use Get Control for a window that's title can change. (MEP refers to window "titles" as window "captions.") 1. Choose "Save control using its coordinates" 2. Delete all text from the "Top Level Window Caption" field that changes. Leave only the unchanging part of the window caption. 3. Change "Exact Match" to "Partial Match." This week I began revising macros that I scripted years ago, that bring windows into the foreground to extract information. Now I am better able to these manipulations in the background. Cory has been talking about this for years... hopefully the rest of us are starting to catch up... and catch on...
  14. This will get you close. You may need to recreate this in Windows 10, as I still cling to Windows 7: <GET CONTROL Flags="1" Program_Name="EXPLORER.EXE" Class="Shell_TrayWnd" Control="\"TrayNotifyWnd\",\"1\",\"SysPager\",\"3\",\"ToolbarWindow32\",\"1\"" Variable="%SysTray%" Partial="FALSE" Wildcards="FALSE"/> <MOUSE MOVE Option="\x04" X="0" Y="0" Control="%SysTray%" _PROMPT="0x000A"/> Get Control: (EXPLORER.EXE) Using z-order -> %SysTray% Mouse Move: 0, 0 Relative to Control: %SysTray% There may be a challenge: the "Running Person" will appear briefly in the System Tray while the macro is running, which will temporarily expand the System Tray. This may affect the precision of the script.
  15. Macro Express Pro supports error trapping, but I'm not sure that will be the best way to script this. I think you are good to go with Macro Express 3. But the time has come for you to get a handle on variables. And possibly the "repeat with folder" command. It's worth the effort to get comfortable with variables. A nice learning project is to assign a variable to a value, modify the value, and then display it. Maybe something like this, in pseudo-code: T1 = "Hello my name is ME" Modify T1: Replace every " " (space) in T1 with "" (nothing) Message Box T1 Result: HellomynameisME
  16. Double-check that you have set a semi-colon as the prefix key in Options > Preferences... > Activations > Shortkeys. Test. If the problem persists.... Try changing the prefix key to, for example, the comma. Test. If the problem persists.... Try closing Macro Express and relaunching it. Test. If the problem persists.... Try shutting down your computer and restarting it. Test. If the problem persists.... Check the scope of every Shortkey macros that are not activating as expected. You probably want Scope = Global.
  17. Macro Express cannot "see" Acrobat Reader DC, at least not Version XI. So MEP macros cannot touch it. DC XI is not accessible by keyboard, not even many of its menu items. The lack of keyboard access is symptomatic of the problem. Macro Express does not cause the problem. The issue is with Adobe Reader. Submit a bug report with Adobe.
  18. There are times when it's worthwhile to abandon a macro and recreate it entirely from scratch. I have wondered whether a form of instability sets in after messing with the variables: copying, renaming, attempting to switch from one type to another, etc. I have seen text variables that, beyond a certain point, are not recognized as text variables. When this happens, I either delete and recreate the variables (usually with different names), or start again. Paradoxically, it may be faster to start from scratch than to repair a complex macro. Subtle logical or syntactical errors can creep in when reworking a complicated macro.
  19. Hi Terry, You and I are facing the same dilemma: we have become skillful at making inferences about the state of a program, or extracting data, by manipulating a program's User Interface. We acknowledge that using controls is a more elegant approach, but our pixel- and pointer-detecting macros sometimes get the job done quicker and more reliably. In my scripting universe, I try to take advantage of controls whenever I can. But sometimes I find that using controls is not worth the effort. Both approaches have value. Often I try both approaches, and then decide which to use based on the larger goals: reliability vs. speed vs. portability vs. maintain-ability, etc.
  20. Terry's approach is sound: set the macro to activate when "Windows Task Manager" opens. His approach for navigating to the tabbed page is different than my approach, but both are likely to work. Cory's suggestion of using controls is more elegant than the approach Terry and I articulated -- acting on the user interface via keystrokes. But controls are more challenging to learn. My experiences of acting on controls programmatically via Macro Express have been mixed. When the approach succeeds, it's phenomenal.
  21. I'm using Windows 7 which does not have a Details tab. Hopefully this simple approach will work. You will need to assign the macro to something different than Ctrl + Shift + Esc. Text Type (Simulate Keystrokes): <SHIFT><CONTROL><ESC> Delay: 100 milliseconds ' Move focus from the listview to the tabbed page control... Text Type (Simulate Keystrokes): <SHIFT><TAB> Delay: 100 milliseconds ' Go to the leftmost tab... Text Type (Simulate Keystrokes): <HOME> ' Arrow over as many times as needed to reach the Details tab... Text Type (Simulate Keystrokes): <ARROW RIGHT> <ARROW RIGHT> etc. ' Move focus from the tabbed page control to the listview... Text Type (Simulate Keystrokes): <TAB>
  22. Report it as a bug. About a year ago I discovered an error condition that Macro Express Pro was not catching. I reported the problem to the good people at Insight, and it was fixed in the most recent release. It even made the list of "bugs fixed" in the most recent release notes! Added 'There is no control to capture' to the list of errors for the 'Capture Control' command. I have had mixed experiences with error trapping. Given enough time, I can make a complex MEP script that will work as expected about 99% of the time. Although I use error trapping on occasion to bail when something goes awry, I tend to look for other ways to force a script to exit gracefully, or go back and repeat a step that was not completed.
  23. Acrobat Reader DC is a troublesome program for anyone who needs an accessible application. After attempts to tame its problems via macros, I gave up. I uninstalled DC and installed a free, well-behaved PDF viewer, and have not looked back.
  24. 1. Add delays between the steps to try to isolate the problem. 2. Or use an alternative way to navigate to the "Find What" field, perhaps something like this: Ctrl + r ' Invoke Replace dialog Wait 500 ms Alt + c ' Landmark on the "Match Case" checkbox Alt + c ' Restore the original value Wait 500 Type "c:\docs" Etc. 3. Use controls to navigate to and around the fields and buttons.
×
×
  • Create New...