Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. Here is how I would explain the difference. Let's say I have created a macro to work while reading this thread, only. Because I am using Firefox, the title bar says: Activation puzzle - Macro Express Forums - Mozilla Firefox If I set the scope to Program Specific, I would need to identify the program: firefox.exe. The macro will respond whenever Firefox is running; the problem is that the it will respond in any Firefox session. If I set the scope to Window Specific, and specify the window to exactly match "Activation puzzle - Macro Express Forums - Mozilla Firefox," the macro is available only in this thread, and only in Firefox. (If I tried with Internet Explorer, the macro would NOT be available because the window title would be different, i.e., "Activation puzzle - Macro Express Forums - Internet Explorer." If I want the macro to work in both Firefox and Internet Explorer, I would set the scope to Window Specific, partial match: "Activation puzzle - Macro Express Forums" (or perhaps "Activation puzzle"). I hope this helps.
  2. I set the scope of my macros to window- or program-specific as needed. I have not noticed one being more or less reliable than the other. Have you experimented with settings such as "wait for Hotkey to be released" (Activation) and "a window with this title must be on top" (Scope)? I haven't had great success when the window title contains a wildcard, but YMMV. Can you reproduce the problem if you leave the scope as window specific, but you change the activation from Shift + T to a function key? Is the macro actually activated when you press Shift + T? (Little man running in SysTray.) If yes, try adding an initial statement that activates the application or window.
  3. Mouse positioning is a very unreliable way to complete a form. A more machine- and browser-independent approach would be to navigate from one field to another via the tab key, maybe something like this: ' Place cursor in first field (maybe use the mouse?) ' Navigate to Field 1... Text Type <TAB> ' Copy value to the Clipboard (field will be selected by default) Text Type <CTRL>c ' Copy the Clipboard to variable T1 Set Text Variable T1 from Clipboard ' Navigate to next field... Text Type <TAB> Text Type <CTRL>c Set Text Variable T2 from Clipboard etc.
  4. Congratulations on finding a workaround. Your solution is about as elegant as you are likely to get using Macro Express. Every scripting language has strengths and limitations. Exploiting the strengths and working within the limitations takes skill, which only comes with time and practice.
  5. It would be helpful to know (1) what the macro is supposed to do; and (2) why you think it needs shortening. In many cases, clarity trumps brevity! (Or instead of being "clear," it may be better for a script to be "reliable," "robust," "portable," and/or "maintainable..."
  6. Probably it can be done, but you will have a far easier time if you simulate keystrokes instead of mouse clicks. Ctrl space to select. Ctrl down to navigate down without selecting, but retaining selected items. For example, to select item 1, 3, and 6 from a list... Ctrl space [select 1] Ctrl down [move down to 2] Ctrl down [move down to 3] Ctrl space [select 3] Ctrl down [move down to 4] Ctrl down [move down to 5] Ctrl down [move down to 6] Ctrl space [select 6]
  7. I do not believe the scripts are backward compatible. You may need to recreate them from scratch. I was thinking that it might be possible to replace Version 4 variable names with Version 3 variable names, and then export. (E.g., %Count% becomes %N1%.) But I don't think this will work, as the structure of commands in the two versions appears to be slightly different.
  8. Yes, it can be done, but it requires clever/flaky coding. The technique I use is to search every pixel along a line, or within an area, for the colour of the selected text.
  9. It depends on the program. Some applications overlay a virtual "layer" over screen objects that prevents Macro Express from detecting colours. But these apps are rare. I have seen one, maybe two. If Macro Express can see the colours -- you can test this with the Mouse Locator -- then it is possible. There is no automatic way to search wide swaths for pixel colours in Macro Express -- I have requested this as a feature! -- but it's possible to construct a macro that checks every pixel along horizontal and/or vertical lines. If you know approximately where the colour is supposed to appear -- say, in a small zone or along a single line -- you can make a macro that executes quickly. But if you make a macro that checks every pixel on a screen, the script can take a long time to run -- probably too long for gaming purposes.
  10. I can set the size of the border like this: Windows Sizing Border: 1 pixels But is there a way to determine the size of the current border? Like this imaginary command... Variable Set Integer %BorderInPixels%: Set to a Border Thickness (%ThisWindow%)
  11. // Method 1 - Use a variable to capture the window title Variable Set String %WindowTitle% to topmost window title // Test if the focused window title contains the words "UltraEdit" If Variable %WindowTitle% Contains "UltraEdit" // Value not found. Do something. Else // Value is found. Select to end of line. Text Type (Simulate Keystrokes): <SHIFT><END> End If // Method 2 - Use the "If Window" command If Window "UltraEdit" is focused // Value not found. Do something. Else // Value is found. Select to end of line. Text Type (Simulate Keystrokes): <SHIFT><END> End If
  12. Maybe try the "PostMessage" command, which allows you to send a Windows message to any control. I've never used it. Maybe others have?
  13. If the mouse pointer cannot be moved for even 5 or 10 milliseconds, you need another approach that does not involve the mouse. Is it possible to perform the task by keyboard? If yes, then your macro will send a sequence of keystrokes rather than mess with the mouse. Alternatively, you might be able to use ME to capture information about the control you want to double-click, and then activate the control programmatically. This is probably the most elegant and reliable solution, although implementing it would not be easy for a beginner.
  14. Maybe something like this? The mouse pointer moves to the target to double click it, but only for a fraction of second. // Capture mouse position (can specify relative to the window or screen) Get Mouse Position into (%N1%, %N2%) Relative to Screen // Move mouse to target, and double click Mouse Move: 100, 200 Relative to Screen Mouse Left Double Click //Restore original mouse position Mouse Move: %N1%, %N2% Relative to Screen
  15. Download Macro Express, and try it yourself. The evaluation period is 30 days, which should be plenty of time to test whether MEP will work. For the record, I have written MEP macros to automate tasks in Craigslist, and they have always worked reliably. Copying and pasting between applications via macros is a good project for novice script-writers. Usually there are challenges, but it's do-able.
  16. Mouse movements may or may not be necessary. I usually find it sufficient to give focus to the target control, without clicking it. As usual, the decision is made case by case.
  17. I have had similar problems when sending text directly to a control. In most cases, I "solve" the problem -- it's not a solution I like -- by putting focus on the field, and then sending the text via "simulating keystrokes. I avoid <ShiftDown> and <ShiftUp>: I prefer a sequence like <HOME><SHIFT><END><DELETE>, which probably gives the same result, but I am superstitious of commands that simulate holding down a key... Alan
  18. There may be tools to do what you want to do, but I don't think Macro Express is one of them! I do use about a dozen Macro Express shortkeys to make it faster to fill out the form fields I need most often: js = John Smith pc = M4K 1X1 ph = 416-555-1234 32e = 32 Eastborough Avenue North etc.
  19. I have scripted many macros to complete forms. Each macro is unique, but usually follows this kind of logic: 1. Move the cursor to the first field. 2. Input value. 3. Press Tab (to move the cursor to the next field). 4. Input value. 5. Press Tab. etc. "Input value" might mean typing a word (e.g., a user name, password, address, or telephone number); checking or unchecking a check box (press the spacebar); choosing an item from a drop down list (there are different ways to do this depending on the form), and so on.
  20. Confirming the bug. I am getting the same result. The variable is not evaluated, but appears literally.
  21. I have Macro Express Pro installed on a Vista and Windows 7 machine, and have not experienced problems recently. There were problems when MEP was first issued, but everything runs smoothly for me now, and has for the previous two or three releases. I remember a few hiccups when MEP updated my ME3 scripts, but almost all translated properly. Some scripts triggered by window events required minor adjustments. But the transition was relatively painless, and overall, I have come to prefer MEP. On occasion, a script that uses <ALTD> or <ALTU> causes the Alt key to get stuck in the down position. In these cases, MEP has to be restarted. But the same thing happens with some of my AutoHotkey scripts. I am not sure about the disappearing macros and categories. It's never happened to me, and I have hundreds of scripts organized into 70 + categories. I am curious what you have done to resolve the problem. Did you uninstall and reinstall MEP? Are you running ME3 at the same time as MEP? Did you test if MEP is conflicting with other programs that monitor keyboard activity? (For example, I have seen Macro Express clash with two different screen reading applications, JAWS and Window-Eyes, although in entirely different ways.) I hope you are able to get to the bottom of this!
  22. To determine whether today is the last day of the month, you need a macro something like this (in pseudo-code): // %T1% is today's month in <num><num> format, e.g., February = 02 // %T2% is the number of days in the month Today's month = %T1% // If January, March, May, etc. If %T1% = "01" OR %T1% = "03" %T1% = "05" etc. %T2% = "31" // If April, June, etc. If %T1% = "04" OR %T1% = "06" etc. %T2% = "30" // Else it's February. (Need a special case for leap years) Else %T2% = "28"
  23. I have not yet installed Firefox 4, but here is something that I experimented with in Firefox 3. The script infers (since we can't detect directly) when a page is fully loaded. It "looks" for the word "Done" to appear on the status line at a particular place. The word is always black, e.g., colour = 0. The macro is supposed to find that spot. This macro is not fully worked out, but I hope that my code will help someone else to make it functional. (My guess is that it will prove necessary to test one or more additional black pixels that are close to the one this script finds.) The strategy is to map out the Firefox UI by using a combination of programmatic information -- the main Firefox window is one big control that MEP can detect -- and pixel colour searches. The script gets the height of the control, which is how the script figures out the position of the bottom of the status line. Then we find the top of the status line by hunting for its top border: check upwards until the pixel changes to "13160660." Then reposition the cursor to the horizontal centreline of the status line, and hunt right for the colour black. I have a different (but related script) that hunts for colour changes in the address line, and it is surprisingly reliable. (I have tested it on several PCs, and it works everywhere... so far!) It would be nice if there was a clear, unambiguous way for Macro Express to determine when a Firefox page is fully loaded... but at least it's possible to do somersaults to get the same result... // Use "Capture Window Control" to capture the main Firefox window. Specify a partial match = "- Mozilla Firefox" Get Control: (FIREFOX.EXE) Using z-order -> %MainFFControl% // Get the height of the main FF control Variable Set Integer %Height%: Set to a Control's Height (%MainFFControl%) // Move to bottom left corner, which should be the bottom of the status line Mouse Move: 0, %Height% Relative to Control: %MainFFControl% Variable Set Integer %StatusLineBottom%: Set to the Mouse Y Coordinate // Hunt upward for the top of the status line Repeat Until %Pixel% Equals "13160660" Mouse Move: 0, -1 Relative to Last Position Get Pixel Color from Beneath the Mouse into %Pixel% End Repeat // Calculate height of status line, and then half way point... Variable Set Integer %StatusLineTop%: Set to the Mouse Y Coordinate Variable Modify Integer: %StatusLineHeight% = %StatusLineBottom% - %StatusLineTop% Variable Modify Integer: %StatusLineHalfHeight% = %StatusLineHeight% / 2 // Move cursor down to centreline of status bar Mouse Move: 0, %StatusLineHalfHeight% Relative to Last Position // Hunt right for black - the status line appears to always contain some black text! Repeat Until %Pixel% Equals "0" Mouse Move: 1, 0 Relative to Last Position Get Pixel Color from Beneath the Mouse into %Pixel% End Repeat
  24. If the field will always contain a comma, you can probably leave out the step of testing for the presence of one. The help system in Macro Express is excellent, as is the assistance that you can get on this forum. Finally, however, the best way to learn to use variables is trial and error experimentation. Take a stab at the problem, one step at a time. For example, begin by writing a macro to select the field. Once it is working, expanded to copy the text to the clipboard. (At this point, you can "prove" that macro is working by pasting into a word processor or text editor.) The next step is to copy whatever is in the clipboard into a text variable. This is a single instruction in Macro Express. Then continue on, one step at a time, until the whole thing is working. If you are a novice scripter, the entire project may take hours (or days) to iron out the wrinkles. If you encounter problems -- almost a given if this is your first exposure to variables -- know that you are on the right forum! If you discover that you can't pull yourself away from the project, then you may find yourself becoming a regular contributor to this forum. Addendum: Just for fun, I scripted this using Macro Express Pro. Rather than give away the solution, I invite you to try first. Macro Express 3 is perfectly adequate for the job. My script has only eight lines of code, and in the end, only required six of the eight steps I set out in my original reply.
×
×
  • Create New...