Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,203
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. Very clever, Alan!

     

    I think the problem of finding the wrong icon, among similarly-named ones, can be resolved also by the technique of beginning to rename the found item:

     

    Repeat Start

    Text Type %target% // Incremental search for item on desktop

    Text Type <F2> // Windows keyboard command to rename an object

    Copy to clipboard

    Compare the copied name to %target%

    If equal

    exit from repeat loop

    else Text Type <ESC> // Cancel the rename operation

    End If

    Repeat End

    Mouse Move: To the Text Cursor Position

    Text Type <ESC> // Cancel the rename operation

  2. See if you can (manually) copy the screen contents by clicking on the screen, highlighting all with Ctrl-a, then copying to the clipboard. Paste the result into Notepad, then post an example of the Notepad text here on the forum, pointing out what fields you need to capture. Once we can see the text data, we can advise you how to parse it and remove what is unwanted.

  3. Oops. I should have been more direct. Sub-macros should end with Macro Return, not with Macro Stop. At least that's the way it works for me. If I do Macro Run several times, and the sub-macro has a Macro Stop, then the whole process stops after the first execution of the sub-macro -- which matches your original symptoms.

  4. If I understand you correctly, all that you describe can be done with ME. If you create the initial macro by recording and saving your manual process, try to fill in the check boxes and dropdowns via keyboard rather than mouse action -- easier to edit later, and less susceptible to changes in the screen resolution or variations from one PC to another. After recording and saving, you will wind up with a macro that will need some (lots of?) editing with the script editor, and you will also need the script editor to add the folder processing. Once you have worked with the editor a bit you will rarely, if ever, create a macro by recording your keystrokes -- it's just easier in the long run to build it from scratch with the editor.

  5. First, after getting the pixel color into N1, you are checking T1 for the desired color value. Easy mistake to make -- but change it to say

    If Variable %N1% = 7143674

     

    Also, the incrementing of D1

    Variable Modify Decimal: %D1% = %D1% + 1

    is controlled by the IF statement, so the value is bumped up ONLY if you have detected a pixel of color 7143674. If you want to exit the REPEAT loop after checking 100 pixels, then move the D1 increment down one line, so it falls after the END IF.

     

    Last, the macro will work perfectly well with your technique of moving the mouse and checking the color under the mouse each time through the REPEAT loop. However, it will work faster if you simply get pixel color at specific coordinates, without moving the mouse there at all. It's more fun to watch the mouse move, and it's also good for debugging because you can see, visually, where you are checking. But it does slow things down. I usually code the mouse movement during testing, then disable that line of code after the macro is working.

     

    P.S. The REPEAT EXIT is out of place and serves no function. It only has effect if it falls between the REPEAT and REPEAT END statements. I would have expected to see it right after the incrementing of N12, so you would jump to the REPEAT END as soon as a single pixel is found with color 7143674. But it looks like you are using N12 to indicate the desired color has been found (or not) within 100 cycles, so the REPEAT EXIT can be skipped, or moved to after the N12 increment.

  6. Instead of putting your color values into N1 through N30, put them one after another into a single text variable:

    VARIABLE SET STRING T1 = 12345678 23456789 34567890 45678901 and so on.

    The blank spaces between values are for your benefit, to make it readable.

    Then each time you want to retrieve a value, move 8 characters to a second text variable, load the integer from the second text variable, and remove the nine characters from the first text variable:

    VARIABLE MODIFY STRING T1: COPY CHARACTERS 1-8 FROM T1 TO T2

    VARIABLE MODIFY STRING T1: DELETE CHARACTERS 1-9

    VARIABLE MODIFY STRING T2: CONVERT TO INTEGER IN N31

  7. Thank you everyone for the replies. I had done the negative of suggestion 5 -- that is, if the window was no longer in focus I was abandoning the typing on the theory that the user had intentionally canceled out of the window. I will try (5) or (6) and see if it flies. It will be vulnerable mainly during the duration of each individual Text Type command -- and I know there will be users who complain about that! It's amazing how 5 per cent of users account for 95 per cent of problems!

  8. We have several macros that retrieve data from one form and type it into another. While typing is taking place, Microsoft Outlook and Avaya Message Manager, among others, may pop up message boxes telling the user he has a new email or message. The pop-up gets focus and the macro keeps right on typing, but the text gets typed into the pop-up box or goes off to the Windows bit bucket.

     

    Can anyone suggest a way to keep pop-up messages from stealing focus? (We can turn off the notification option in some applications, but some people would rather not.)

  9. There are many forms where controls don't work, or don't work the way you need them to.

     

    Straight typing with a macro should work. If you can type by hand, the macro should be able to type. On some forms, you might have to position for typing by clicking the mouse in the first field to be typed, or by clicking somewhere on the form and then tabbing into the first field. Take note of exactly how you do it by hand, then simulate that with the macro.

  10. If you have ME copy to clipboard, from a Word document, then Alt-Tab to another Word document and type from the clipboard, the italics are kept. Once you move the text from the clipboard to a ME text variable, the italics are gone even if you then move the text back to the clipboard again.

     

    Even with the Word-to-Word copy, I suspect MS-Office is using its own clipboard stack to carry the text, rather than the Windows clipboard.

  11. The only way I know to move it is to specific x- and y-coordinates. If you need to adjust for multiple users who format their menus and tool bars differently, then maybe you can find some attribute on the screen that give you an adjustment factor. For example, I have macros for a web-based application used by dozens of PCs, and the initial window has a blue band across the top about 80 pixels from top to bottom. So I scan downward from the top of the screen looking for that color, make sure the next 80 pixels downward are the same color, and record the y-coordinate where the first blue pixel was found. After that, all mouse movements are window-relative plus or minus the band factor.

  12. Terry, I'm kind of thinking out loud here, so don't hold me accountable if I say something really dumb.

     

    You want to deal with a panic situation, where there is a macro out of control. How about Ctrl-Alt-Shift-v to terminate ME? You kill off all running macros, but that is acceptable if you kill the offender along with all the others. Of course, as Kevin says, if Windows won't pass the keystrokes to ME, then that's no good.

     

    Or if Windows lets you get to Task Manager, have a macro consisting of the single command "Terminate process: macexp.exe". Have that macro triggered by the Task Manager window title. Of course then you would have to enable the macro when you want the safety valve to be active, and disable the macro when you want to use Task Manager normally.

     

    Ideally there would be a way OUTSIDE of ME to kill ME, other than through Task Manager, which takes too long. For example, a .cmd file that runs the Windows "kill" or "pskill" command. But how to make that .cmd file run when you want it to, especially if keyboard and mouse are locked out??? I don't know.

  13. There is no displayable character for the Carriage Return byte, nor for the Line Feed byte. So Clipmate may just be showing them to you as spaces to indicate that there is SOMETHING in those character positions. To keep the character positions in your text typeout, you need to do the same thing: change them to spaces. You can do that with the Replace Substring option of Variable Modify String.

     

    Variable Set T98 to ASCII 13 (Carriage Return code)

    Variable Set T99 to ASCII 10 (Line Feed code)

    Variable Modify String append T99 to T98 (CR/LF is now in T98)

     

    Variable Set String T1 from Clipboard (put your text into a variable where you can manipulate it)

    Variable Modify String T1 Replace Substring %T98% with ' ' (two blanks) [all instances]

    Type the T1 string rather than the clipboard

  14. ... these 2 MEP commands simply interrogate the display and set 2 variables with the current width and height; they have no impact at all on what the operating system sees.

    The question was, to find out what the current settings are, not to have an impact on (i.e., change) the current settings. When I have used those two commands, the numbers returned always match what is shown by Properties | Settings | Screen Resolution. Maybe I'm missing something and I've just been lucky that it works in my situation?????

  15. This is a little off topic, but there are some smart people here so I'm going to ask anyway.

     

    I have an ancient but wonderful MCK-142 programmable keyboard. It has 24 programmable keys, call them PK1 through PK24. No special drivers or software are used with the keyboard -- all the programming is done on the keyboard itself and stored internally.

     

    I used the keyboard with Macro Express by programming keys to activate macros. For example, PK1 might be programmed to send sequence Ctrl-Alt-Shift-F1. Ctrl-Alt-Shift-F1 would run a macro. It was just easier to do a single keystroke than a four-key combination.

     

    Anyhow, the keyboard has an AT connector plug, then an AT-to-PS/2 converter cable, and it always worked fine with my old computer's PS/2 keyboard socket. My new PC has no PS/2 socket, so I daisy-chained a PS/2-to-USB converter onto the cable. So now it is AT-to-PS/2-to USB. It works fine for anything I physically type. However, when I activate one of the programmed keys, garbage data goes to the PC and indicator lights on the keyboard go off.

     

    I have a feeling that maybe USB can't handle the AT scan codes sent by the keyboard. But then why would manually-typed character work? I have no clue where else to look to fix it. Suggestions gratefully accepted.

×
×
  • Create New...