Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,201
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. I'm afraid I won't be much help. I know nothing of Delphi. I tried to do it today as my first-ever project with AutoIt. It should be a one-line AutoIt script: BlockInput(1) or BlockInput(0) to lock / unlock both the mouse and keyboard. But it's not working for me. I must be doing something wrong. I suppose I should just give in and install ME Pro, since we just upped our licenses to 100. But we're in the middle of rolling out a couple projects developed with ME3, and that's not a good time to rock the boat.

  2. I came across this old thread while looking for something else.

    I currently have a similar problem with the LASt character of each field being converted to lower case when typed with the TEXT TYPE command. It only affects alphas, not numeric characters, and only on one specific web-based form. So it may be a form problem or an IE problem rather than an ME3 problem. I got around it by appending one space character to the end of each variable before typing it.

     

    FWIW Cory's suggestion, to use the clipboard option in the text type command, has been very unreliable for me. Clipboard options in general have been very unreliable -- they will work fine on one computer but not on another, or they work fine now but fail ten minutes from now. Next time Bill Gates drops by, I'll ask him to look into it.

  3. Build the source name in a text variable, for example

    VARIABLE SET STRING T1 = C:\FOLDER\*.*

    Same for the destination, for example

    VARIABLE SET STRING T2 = C:\NEWFOLDER

    Then use the COPY FILE OR FILES command with %T1% and %T2% as the file values.

     

    Alternatively, build a DOS-style COPY, XCOPY, or MOVE command in a text variable, save the variable to a text file with the .BAT extension in its name, then launch the .BAT file with the PROGRAM LAUNCH command.

  4. I sat down at my PC this morning with exactly that thought, Bob

    I looped through the whole hidden list, unhiding and putting on top for two seconds then hiding again. Many were simply a little piece of a title bar. Many others were a title bar with a window frame but nothing in it. Some of the empty windows were transparent, some were opaque. Nothing exciting appeared except the laptop Power Meter.

  5. Try adding a Text Box Display right after IF CONTROL FOCUSED, to verify that ME in fact recognizes when it gains focus.

     

    I tried your logic with a button in the Windows Calculator application, and a button in the file-save box of Notepad. I had no problem with IF CONTROL FOCUSED. However, WAIT FOR INVISIBLE worked with Notepad but not with Calculator. WAIT FOR LOSE FOCUS worked on both. Can you perhaps use that instead?

  6. I haven't yet found an example where If Mouse Cursor works reliably for any cursor type in MEP (as distinct from ME3 where they all work OK).

    I'm using ME3, trying for the first time to use IF MOUSE CURSOR. My macro moves the mouse across the screen, waiting for the icon to change from an arrow to the pointing hand when it reaches a clickable web address.

    When I code IF MOUSE CURSOR NOT ARROW, the change is detected. However, if I code IF MOUSE CURSOR IS POINTING HAND, I never get a hit even though I can see the icon change.

     

    Is there some setting in Windows Control Panel that might fix this, or have some of you had trouble with the mouse cursor in ME3 as well as MEP?

     

     

     

    Edit: Never mind! I changed it to IF MOUSE CURSOR IS INTERNET NAVIGATE and now it's happy.

  7. I have found it is not good to be overly precise with pixels. You might capture the pixel string today, and again tomorrow, and find tiny differences between them, or tiny differences from one computer to the next, which renders an exact comparison useless (even if we could figure out how to do it).

     

    IF you know approximately where the control is, here's something I have found to work on a number of windows:

     

    Set x-y coordinates in the "background" area of the window, above where the control is to be found (or to its right, or left, or below it).

    Find pixel color at the beginning point.

    Step one pixel position at a time toward the control. At each step, check whether pixel color has changed (indicating the boundary of the control).

    Step the coordinates by 5 or 10 or whatever to put you well within the control, rather than at its boundary.

    Click on it, or capture it, or whatever you want to do.

     

    I don't know if this helps you or not. Maybe you could provide a few more details of what type of control you are trying to locate, what application the window is for, and so on ....

  8. This is what I mean by getting rid of the REPEAT and all the references to %N2%:

     

    // ***OPENING MONARCH****

    Variable Set Integer %N2% to 1

    Program Launch: "Monarch.exe"

    Wait Time Delay 3 Seconds

    Text Type: <ALT>f

    Wait Time Delay 1 Seconds

    Text Type: R

    Wait Time Delay 1 Seconds

    //

    If File Exists "VCRR"

    ~~~~~

    End If

    //

    If File Exists "VCCBK"

    ~~~~~

    End If

    //

    If File Exists "VCREP"

    ~~~~~

    End If

    //

    If File Exists "MCRR"

    ~~~~~

    End If

    //

    Wait Time Delay 1 Seconds

    Text Type: <BACKSPACE>

    Wait Time Delay 1 Seconds

    //

    If File Exists "MCCBK"

    ~~~~~

    End If

    //

    If File Exists "MCREP"

    ~~~~~

    End If

  9. ... the variable is set to 1 and when asked to increment it is getting incremented twice. But afte that it gets incremented properly. basically Variable N1 is becoming 2 but going to 3 and from there onwards 4, 5... so on

    I think you mean Variable N2; there is no reference to N1 in the macro. I put a text box display of N2 right after the REPEAT UNTIL statement, and it is incrementing properly for me.

     

    The REPEAT structure and the use of N2 seem to serve no useful function, since you execute a separate block of code each time through the REPEAT loop. Why not get rid of the REPEAT and all checking and incrementing of N2, and simply run the blocks of code for each IF FILE EXISTS one after the other?

  10. ... given that ME Pro 'knows' that it's had to launch the program, I'm wondering if there's some indication of that I could access somehow?
    I don't think ME stores any indicator that you can access. However, as Phonemes says, why not make your own indicator? Do a simple test, before the ACTIVATE OR LAUNCH, where you set a switch to be checked at the end of your macro.

     

    IF PROGRAM 'NOTEPAD' RUNNING

    VARIABLE SET T99 = 1

    END IF

     

    ACTIVATE OR LAUNCH

     

    OTHER MACRO STUFF

     

    IF T99 <> 1

    TERMINATE PROCESS 'NOTEPAD'

    END IF

     

    If there are multiple instances of NOTEPAD running, TERMiNATE closes one instance -- in my testing, it seems to close the one that was chronologically the first one started. But you would probably want to test that further before assuming that it is so. The Help screens did not say.

  11. Is there any way that MEX can distinguish between 2 windows which have the same name?
    Another method I have used is, click somewhere on the window (sometimes necessary with web pages), then do CTRL-a to highlight all the text, copy to clipboard, then "IF CLIPBOARD CONTAINS" some text that is unique to one window or the other. Click again on the window to un-highlight.

     

    The drawback to this, compared to checking various pixel positions, is that it's visible and potentially disruptive to the user.

  12. Is there any way that MEX can distinguish between 2 windows which have the same name? Maybe by position or size or by selecting it manually in a kind of learnmode?

    The learn mode is an excellent idea, if each window has unique characteristics. Write a little macro that checks pixel color at the mouse location, and appends the coordinates and color to a text file. [use a hotkey combination to run the recording macro, because if you actually click the mouse (rather than just position it) the application is likely to do something based on your click.]

     

    You can save the pixel color at one point or many points, in a separate file for each window. Then, when another macro wants to distinguish one window from the other, it just reads back each file of window coordinates, checks the pixel colors, and if they match perfectly you have identified the window.

     

    I have a whole application based on this method, because the application is web-based and seven different windows all have the same title.

  13. Ever bought a global sold product with manuals in 16 languages?
    I have bought hardware from IBM with booklet explaining, in 68 languages, that one should be careful when plugging in the power cord.

     

    BTW Wouldn´t be "your English has much improved" better englisch?
    Ah, the subtleties of Englisch. "is much improved" and "has much improved" are both equally correct. "has" denotes a period of time during which something occurred. "is" refers to the present condition of something without really specifying when it reached that condition. Another way of looking at it is, the phrase "has improved" is a verb form, like saying "I grew taller". The phrase "is improved" uses improved as an adjective, for example "I am taller than I was last year".

     

    Don't worry. Your English is excellent.

  14. i tried exactly what you said. i estimated my regular area ... told my macro to move around the estimated area

    That is not exactly what I said. I said analyze the whole screen both before and after the "find".

     

    But here is a variation on your method of estimating the area where the text will be:

    Treat the whole window as the "estimated area". First, in order not to have such a large area for pixel checking, use ME commands to re-size the window to be very small, maybe a quarter or a tenth of the screen size. Making it full-screen width, but one-tenth screen height, would be a good starting point for testing. Then when you do the "find" most browsers and other applications will bring found data to within the display window, giving you a much smaller area to search compared to the full screen.

     

    No guarantee that it will work, but it's worth a try.

  15. The only way I can think to do it, is scan and record pixel colors on the screen before the "find". Then scan again after the find, and where pixel color has changed due to highlighting is where you want to move the mouse to. I fear this would be unacceptably slow with Macro Express, if you scan every pixel. However, if you know that a highlighted word will cover a minimum of, say, 20 pixels high by 40 pixels wide, then you could scan in increments of maybe 10 by 20 pixels and reduce the time considerably. (I'm just making very rough estimates here.) It still might be unacceptably slow. The only way to find out would be to write the logic and try it. Shouldn't be too hard to code it.

×
×
  • Create New...