Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. Searching for a button can be made to work. From your description, it sounds like the button you want to activate is an actual pushbutton, not a hypertext link styled to look like a button. It is not possible to search for pushbuttons because they do not consist of actual text. This web site (pgmacros) has many examples of non-text buttons. For example, when you are composing a message on this forum, you cannot search for the "Add Reply" button because the words are not actual text. So you cannot use your browser's find command to move to the "Add Reply" button. But try this: Identify unique text that occurs NEAR the "Add Reply" button, e.g., "Enable email notification of replies?" or "Use None." Then search for that text. Then Tab one or more times until the button gets focus. (If you search for text that appears after the button, use Shift + Tab.) Then press spacebar to activate the button. The macro will look something like this: //Initiate find Text Type <CONTROL>f // Wait for Find dialog to appear... Wait 200 ms // Search for text... Text Type "Use None" // Start Search Text Type <ENTER> // Close Find dialog... Text Type <ESC> // Wait for Find dialog to go away... Wait 200 ms // Tab to Add Reply button... Text Type <TAB> // Activate it... Text Type <SPACEBAR> This is not a bulletproof solution, but I hope it gets you started. You should also check the source to see if whether the web developers use the accesskey attribute for anything. If yes, you may be in luck. Accesskey is a hotkey to navigate to a fixed location on a page. For example, if the accesskey for a link is "X", then you can navigate directly to that link with Alt + X (IE) or Shift + Alt + X (Firfox). Then Tab or Shift + Tab to your target, as above. If you check the source for this page, you will discover this line: <input type="submit" name="dosubmit" value="Add Reply" tabindex="7" class="button" accesskey="s" /> That's the code for the "Add Reply" button, which has accesskey = "s", which means you can activate it directly with Alt + S (IE) or Shift + Alt + S (Firefox). No searching required!
  2. I don't know what the problem is, either, but I do have ideas on how to debug it. Why not begin by creating a series of macros to resize the window, using different values, to determine whether there is a pattern. You might want to throw in a couple of lines like this to help with debugging. <IVAR2:01:09:><IVAR2:02:10:><TBOX4:T:1:CenterCenter000278000200:000:Width = %N1% Height = %N2%> Variable set integer N1 from window width Variable set integer N2 from window height Textbox Display Width = %N1% Height = %N2%
  3. I have done it this way, and the approach is do-able, but scripts to automate the process tend to be flaky. Searches in Firefox work differently (and are more customizable) than searches in IE, so you may need different macros for each browser. Depending on the page, it may be more reliable to search for text AFTER the checkbox, and press Shift+Tab to reach it. See whether the the authors of the page use the "accesskey" attribute. Open the source, and search for "accesskey." If yes, you are in luck, because accesskey provides an elegant way to navigate to form controls. If the accesskey for the checkbox you want to activate is, say, "T", then you can navigate directly to the checkbox by pressing Alt + T (IE) or Shift + Alt + T (Firefox). Even if there is no accesskey to the particular checkbox, but there are accesskeys to other form controls or links, you will have an navigational "anchor" available. For example, if there is an accesskey (say "X") that puts focus on the link 10 tabs before the checkbox, you could write a script like this: Text Type Alt + X Repeat 10 times Text Type Tab Repeat End Type Text spacebar
  4. Me too, and I came up with a solution for the Scripting Editor, since I almost always use milliseconds instead of seconds: 1. Create a new macro, and choose "Window Title" as the activation. 2. Set the window title to "Set Delay". 3. Set the scope to program to "MACEDIT.EXE". 4. Enter this two line script: Text Type: <ALT>m Text Type: <TAB> The only problem is that you must type the value quickly, as the macro gets reactivated every time a character is typed! Not perfect, but a start...
  5. Try changing the activation of the macro from a right mouse click to a hotkey, say, F10. If the macro still fails, the problem is with the script.
  6. Easy, once you know how. In the Scripting Editor, choose "Text Type." Then wrap a variable name in percent signs. The resulting script will look something like this: // Insert T1 - Shipping Address Text Type: %T1% // Tab to the next field... Text Type: {Tab} // Insert T2 - Email Address Text Type: %T2%
  7. The "Activate" command is the way to go, but there are situations when you want to switch between two applications, but cannot know in advance what they will be. For example, copy text from Firefox OR Internet Explorer, and paste it in WordPad OR Notebook OR WordPerfect OR Word. Rather than write different macros for each case, or create a single macro to cover every scenario, you may want to use Alt + Tab, but manually set the two applications before you activate the macro so that the windows are in the "correct" order. If you do this, and find Alt + Tab unreliable, also try these other key combos for task switching: Shift + Alt + Tab Alt + Esc Shift + Alt + Esc
  8. Hello Terry, When using third-party macro development tools like Macro Express, we are sometimes limited in our ability to capture programmatic "under the hood" information. Instead, we are forced to do somersaults and backflips with the UIs of the applications we are scripting for. If you can script a macro that quickly and reliably records data by opening a Properties dialogue, navigating to the fields that contain the data, capturing the information, closing the Properties window, and returning focus to where it was when you started, you have accomplished something! It is fiddly, but this is the only way to perform certain tasks if one's primary tool is Macro Express.
  9. To add to Steve's excellent advice about making a macro that is triggered by a window title: 1. The window title must be the exact title as it appears. I have seen instances where the title includes hidden characters, so it is not always possible to type in a title. Unfortunately, Macro Express does not have a way to capture the window title when you create a macro. Here is a technique to capture the window title after you have created a macro: Make sure that the window whose title you wish to capture is open. Switch to Macro Express, and create a new macro using any activation method -- it doesn't matter. Go to the "Properties" Page, change the activation method to "Window Title," then click the adjacent "Browse" button to select the desired window. 2. My experience has been that the scope of macros that are activated by window title usually need to be set to "Global." This is counterintuitive, but I find it to be true most of the time. Feature request to Macro Express developers: Include a "Browse" button in the "Add Macro" dialog when the user selects "Window Title" as the activation method.
  10. This should not be too hard to do -- provided you allow the non-focused window to momentarily get focus. This is not perfect, but hopefully will get you started: <REM2:T1 = Window that currently has focus...> <TVAR2:01:06:><REM2:Bring Notepad to the foreground, or launch it if it is not running...> <LAUNCHYES3:0:0112- Notepad <LAUNCH:C:\Windows\System32\notepad.exe> <REM2:Wait up to five seconds for Notepad to get focus (but it should not take nearly that long)> <WAITWIN2:000000:000005:Notepad> <TEXTTYPE:<F1>> <REM2:Wait up to five seconds for Help to get focus (but it should not take nearly that long)> <WAITWIN2:000000:000005:Help> <REM2:Switch back to original window...> <ACTIVATE2:%T1%> In ME pseudo code: Variable Set String T1 from Window Title Active or Launch Notepad Wait for Window Title Notepad Text Type <F1> Wait for Window Title Help Activate Window T1
  11. Thank you Steve and Kevin for helping me think this through. Steve, I tried your idea of "hiding" the Macro Express user interface behind a text box. (It closes automatically when the script is finished running.) Taking this extra step should go along way toward preventing a user from "accidentally" throwing off the script by typing. And Kevin, it's useful to know what aspects of the macro can be performed by importing a file, and which must be performed by manipulating the user interface. In the end, the code for creating the script portion is only a small part of the whole, so there is no good reason not to do it through the user interface, if it can be done reliably. I appreciate your help.
  12. I don't think this is doable. Macro Express hotkey macros, including those that are triggered by mouse buttons, activate not when a key is pressed, but when a key is pressed and then released.
  13. I have developed a little macro for creating text macros on the fly. It works by automatically generating a new ShortKey macro that types out text. Once triggered (by hotkey), the macro prompts the user for two things: a word or phrase; and the ShortKey associated with that word or phrase. These values are stored as text variables. Then the macro launches the Macro Express editor, and manipulates the user interface to do the following: 1. Pick the Category in which to keep the macro. 2. Add a new ShortKey macro. 3. Give it a nickname (based on the ShortKey). 4. Generate the script. 5. Save the new macro. 6. Close the Macro Express editor. This macro is more reliable than it has any right to be, given its complexity. It takes about 5 seconds to generate. The macro works, although I am very aware of all of the ways that it could be made to fail. As a way to increase its reliability, I am wondering whether it is possible to perform the above steps without opening the Macro Express editor. For example, is there a way that I could get Macro Express to write all of the above information to a file, and then import that file?
×
×
  • Create New...