Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,201
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. I've had similar scary experiences, like the other day when a macro ran away and highlighted all the dozens of icons on my desktop and kept moving the mouse so I couldn't get to the running man and I was trying to remember whether that macro had a <DELETE> coded in it ....

     

    I am wondering if I could set my programmable keyboard to do Start | Run | taskkill macexp.exe. Then I could label the key with a big red sticker like the panic button on machinery.

  2. Repeat Until %T1% <> ""

    Clipboard Empty

    Clipboard Copy

    Variable Set String %T1% from Clipboard

    Repeat End

     

    terrypin: Yes, I do empty the clipboard before each copy. Good point!

     

    Rand: Yes, that's pretty much the right approach, but the Repeat should be AFTER the Clipboard Empty and Copy so the Copy only happens once. I include a 20 ms delay inside the Repeat loop, more so that I can time bringing the loop to an end than for any other reason. Remember that, if the data being copied is null, your Repeat loop above will never end on its own....

     

    Also, you can test the clipboard itself for null value, rather than take the extra time to move its value to T1. Finally, this whole approach relies on the fact that the Clipboard Empty command itself does not rely on a delay time, it just works, period!

  3. If the copy works via manual keystrokes, and you are duplicating those keystrokes in your macro, then I would suspect a timing issue. Are you familiar with Options | Preferences | Delays | Delay After Clipboard Commands? That option is there because Windows apparently does not complete clipboard functions in a reliable time-frame. Setting a delay allows "most" clipboard functions to complete properly.

     

    The problem is, completing "most" clipboard actions properly is not adequate for a production application. Setting a high-enough delay makes it almost fail-safe, but can make the application unpleasantly slow for users. Because of that problem, and based on suggestions in this forum, I never do a simple Clipboard Copy. Rather, I set the ME delay to zero, and call a simple macro that issues the Clipboard Copy, then loops every 20 milliseconds checking for non-nulls in the clipboard. If after 50 loops (about a second) the clipboard is still null, the macro exits making the assumption that the actual data to be copied was null. The excessive delay experienced by users then occurs only for null fields. So far this technique seems to be 99.99999 percent successful -- that is, I have seen no failures, but never say never ....

  4. Convert both times to minutes, for example using N91 for current time,

    N91 = (N31 X 60) + N32

    if T33 = PM

    N91 = N91 + 720 [720 is number of minutes in 12 hours]

    end if

     

    Then you can directly compare the minutes variables to see whether timer has been passed or not.

     

    Subtract current minutes from timer minutes to see how long until the timer "goes off".

    To convert it to hours and minutes, just divide by 60 to get hours, and the remainder is minutes.

    For example, if N99 is minutes remaining, then hours remaining N98 is

    N98 = N99 / 60

    and minutes over the hours N97 is

    N97 = N99 - (N98 * 60)

  5. Possible to make it wait for closing the text box and then just add 'Delay 30min' -> ' Repeat End'?

     

    Yes, but.... If the macro is sitting on a delay, it is still running, so no other macros can run -- you have effectively blocked ME from doing anything else. I'm talking about ME Release 3 here -- I believe ME Pro has the ability to run more than one macro at a time, so the blocking might not be relevant on ME Pro.

  6. Try, if possible, clicking somewhere prior to the first box, so that a TAB will then jump you to the first box. For example, I have a form where there is a label to the left of the first box, like so:

    LAST NAME: [box to enter last name]

    I have found that clicking on the label, then typing a TAB, positions me reliably to the first box.

     

    Also try putting some WAIT FOR TEXT commands after typing fields; and/or some WAIT FOR WEB PAGE commands. These seem to be especially helpful in cases where there is a drop-down box and Internet Explorer needs time to react when you enter data into a field. It may be wishful thinking or my imagination, but these WAITs seem to make my web forms work better -- slower, but far more reliable.

  7. Terry and Steve -

     

    I have used the <CTRL>a technique with Internet Explorer, never with Firefox. On some IE screens I found it is necessary to click once with the mouse, somewhere inside the window, before doing the <CTRL>a. Without the click, nothing gets highlighted and therefore nothing is copied to the clipboard. Depending how the browser screen was built, it might be necessary to click in different areas, say near the top as opposed to the middle, etc.

  8. When you do the FIND, does it highlight the found word? If so, then this may work: copy the highlighted word into the clipboard and check clipboard contents like this:

     

    CLIPBOARD EMPTY command (sets clipboard content to null)

    FIND word

    CLIPBOARD COPY command

    IF CLIPBOARD TEXT = "searched-for word"

    DO WHATEVER

    END IF

    IF CLIPBOARD = "" (nulls)

    DO WHATEVER (word not found, so copy-to-clipboard does not put anything into the clipboard)

    ENDIF

  9. Yes, I have quite a number of macros initiated in that way from my mck-142 programmable keyboard. Why anyone would NOT demand a programmable keyboard is beyond me. I told my boss, last time he had to buy me one, that it's worth half a person. So he thought it was a good deal. Whether he thought he was bringing me up to 1.0 or to 1.5 I'm not sure.

  10. Not sure of the answer to your question. You could test it out by appending the current value to a text file in each macro, then look at the text file and see if it is changing.

     

    To be sure of keeping the value from macro to macro, do Save All Variables at the end of each macro, and Restore All Variables at the beginning of each macro.

  11. Just another guess here: In the macro script editor, click the Scope tab and make sure it is a Global macro, and not limited to one particular window title or program name.

     

    The fact that it has worked OK until recently says that there can't be too much that is wrong. I believe most ME installations come with a system macro (CTRL_ALT_0) that will shut down and restart ME. That's worth a try.

  12. Again, I don't know just what you are doing, but I am guessing the delays are to give the screen time to change. Another trick you can use, to find out when the screen has changed, is to use a repeat loop to check pixel color at a location that you know will change when the screen changes. That way the macro will automatically adapt to how fast your system is running on a particular day. The loop should have a delay coded inside it to give the system a realistic amount of time to change the screen.

     

    For example:

    // wait up to 10 seconds for screen change

    get pixel color at x-coord, y-coord into N1

    set N99=0

    repeat 99999

    add 1 to N99

    if N99 > 100

    display error text box "didn't change within 10 seconds"

    macro end

    end if

    get pixel color at x-coord, y-coord into N2

    if N2 <> N1

    repeat exit (screen has changed)

    else

    delay 1/10 second

    end if

    repeat end

×
×
  • Create New...