rberq

Members
  • Content count

    643
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by rberq

  1. If the data is consistent -- that is, name portion is exactly the same in both databases -- perhaps you could use the length of the name. Variable Modify String: Right Trim %T72% (get rid of trailing blanks in name) Variable Set Integer %N72% from Length of Variable %T72% (length of name into variable N72) Variable Modify String: Delete Part of %T73% (starting position 1, length N72) Variable Modify String: Trim %T73% (get rid of leading and trailing blanks in title) If the names are not identical between the two databases, it becomes vastly more complicated.
  2. See if you can struggle through making my macro or acantor's work for you. You will learn a lot. If you give a man a fish you feed him for a day ....
  3. Very clever! Thanks for posting this. So, are you saying this works without the Program Manager screen temporarily replacing JPEGView? Or do you mean Program Manager flashes up and is replaced by JPEGView so quickly that it is no longer a problem?
  4. This macro will search a rectangular area. The "rectangle" can be as simple as a single horizontal or vertical row of pixels depending on how you set the upper-left and lower-right boundaries. There is no error checking in the macro -- if you exceed the limits of the screen, or specify a bottom-right point that is above or left of the top-left point, results are not guaranteed. The first Mouse Move command makes the mouse track the pixels being checked, which is handy for testing because you can watch the search pattern. That Mouse Move should be inactivated for normal usage as it slows the macro down considerably. Log Message to Default Error Log Log Errors // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Keystroke Speed: 30 Milliseconds Mouse Speed: 30 Milliseconds // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // // This macro is intended to be called from another macro // Macro searches rectangular area for specifie pixel color, puts mouse on first pixel found // // Variables passed from caller: // .... %N90% and %N91% Top left corner of area to be searched (screen relative) // .... %N92% and %N93% Bottom right corner of area to be searched (screen relative) // .... %N94% Pixel color to be located // // // For testing set up coordinates normally passed from calling macro Variable Set Integer %N90% to 800 Variable Set Integer %N91% to 500 Variable Set Integer %N92% to 850 Variable Set Integer %N93% to 500 Variable Set Integer %N94% to 6956042 // // // Copy search area coordinates to working variables Variable Modify Integer: Copy %N90% to %N20% Variable Modify Integer: Copy %N91% to %N21% // Search until pixel color found or until area boundaries exceeded // Search proceeds left to right in a row, then drops to next row, etc. Repeat Until %T1% <> %T1% // For testing move mouse to next pixel to be checked Mouse Move Screen %N20%, %N21% Get Pixel: Screen Coords: %N20%,%N21% into %N24% If Variable %N24% = variable %N94% Mouse Move Screen %N20%, %N21% Repeat Exit End If // Bump pixel coordinates Variable Modify Integer: Inc (%N20%) If Variable %N21% = variable %N93% AND If Variable %N20% > variable %N92% Repeat Exit End If If Variable %N20% > variable %N92% Variable Modify Integer: Inc (%N21%) Variable Modify Integer: Copy %N90% to %N20% Else Variable Modify Integer: Inc (%N20%) End If Repeat End // // // // Macro Return
  5. That would be a handy feature to have. You could write a macro to do it, that could be run (called) from any number of other macros. The calling macro would simply pass the starting location and dimensions of the search area to the called macro (in variables), along with the color to be searched for; with results returned in another variable. One scan of a 100x100 square is fairly time-consuming -- perhaps a second on my PC running Windows 7 and ME 3. There have been recent threads on this forum complaining of MUCH longer pixel-check times on Windows 10 systems, indicating such an extended search must be done in some other computer language than Macro Express and might not be feasible even there.
  6. I have noticed if you do a copy or move, then right clicking gives you the option to undo that copy or move -- it does not revert to the the last delete. If you undo a delete then right click, you get the option to re-do the delete (or copy, or move). So it is context-sensitive to your last action, and could quickly degenerate into who-knows-what if you are not watching closely. Perfect is the enemy of good. At this point you are good. Be satisfied.
  7. This appears to be a duplicate post. Replies are in the other thread.
  8. To enter ‘1’ in a cell, you typically press the ‘1’ key, then ENTER or TAB or ARROW DOWN or something of the sort. That completes the data entry and moves to another cell. So you could try this: 1) Trigger your macro with a function key, like F1, or whatever other trigger you like (but NOT ‘1’ or ‘2’, etc.) 2) Type the value into the cell, then trigger the macro with your chosen hot key. 3) The macro types ARROW DOWN to complete the data entry and move down one cell. 4) The macro then types ARROW UP to return to the cell just entered. 5) The macro types CTRL-c to copy cell value to clipboard. 6) The macro evaluates the clipboard value, then performs the appropriate ‘1’ or ‘2’ function as you coded in your examples, depending what is in the clipboard. All functions to be performed by the one macro, with a series of IF CLIPBOARD EQUALS tests. If a value was entered that you don’t care about, macro doesn’t do any more typing. The macro is not really "listening" for the key entry as you wish, since it requires the hot key to initiate the macro after typing the value. The only other way I can think of is to keep the individual macros as you have them, but limit their scope to Excel or to the specific spreadsheet you are working with (based on window title perhaps).
  9. When you enter the command IF VARIABLE %T[n]% = you must NOT type the double-quotes in the value (comparison) field. That is, to compare to an empty field, you type nothing at all in the value field. You do not type “”. Similarly, to compare to a single blank, you type a space in the value field, you do not type “ “. At least that’s the way it works in ME version 3. Can’t tell if that is your error or not, from what I can see in your message. The file processes as you want it to on my machine – that is, field 7 is empty on most lines as far as ME is concerned. // ASCII File Begin Process: "test.csv" (Comma Delimited Text ) Text Box Display: %T1%,%T2%,%T3%,%T4%,%T5%,%T6%,%T7%,%T8%,%T9%,%T10%,%T11%,%T12%,%T13%,%T14%,%T15%,%T16%,%T17%,%T18% If Variable %T7% = "" OR If Variable %T7% = " " Else Text Box Display: T7 contains data End If ASCII File End Process //
  10. I have seen Windows-automation programs that do similar functions to ME, even better, but instead of buying them outright for $45 I can lease them for $100,000 a year. Hmmmmm. Lemme think. Which one should I get for navigating a few screens to check my credit card balance? As for professional outcomes, I have written LAN-based ME systems used by hundreds of simultaneous users, monitoring and responding to and interfacing among dozens of unique application windows. All that was after the "long, long time ago" that you say ISS gave up.
  11. You are close, but the IF needs an END IF. Structurally the code below should work and should not produce an error diagnostic. Logically your instructions check the pixel color variable twice: (1) in the REPEAT UNTIL line and (2) in the IF VARIABLE EQUALS line. You don’t need to check it both places, because either one will exit from the REPEAT loop and go to the TEXT TYPE instruction. Repeat Until Variable Equals Get Pixel Color into Variable If Variable Equals Repeat Exit End If Delay 2 Seconds Repeat End Text Type Text Type
  12. Ah! Thanks for the visuals. Do you have to actually grab the slider with the mouse and drag it, or can you just click the mouse on the right hand end of the slider scale? For example, playing a YouTube video either method works to get to the end of the video. Or, I can click anywhere on the scale line and the slider jumps to the mouse-clicked position, where it can then be grabbed and moved.
  13. I notice your original post mentions moving about 220 pixels. Can you get closer on the original positioning of the mouse, so it doesn't have to scan so far? I have done that on a couple of pixel-color searches, to speed up the macro.
  14. I have a few macros where I move the cursor and watch for it to change format, rather than looking at pixel color. For example, changing from arrow to finger when it reaches a URL. Here’s a loop watching for the vertical beam to change to something else. I don’t know if that would be any faster for you, or feasible for what you are trying to accomplish. It is easy for the mouse to overrun the macro if you move it too fast or too-large increments. The routine below fails perhaps 2% of the time because the mouse moves past its target before Windows changes the format. I use Windows 7, not 10. // // Scan down until mouse cursor is no longer vertical beam. Repeat Start (Repeat 125 times) Mouse Move Position 0, 3 Get Mouse Position Screen: %N47%, %N48% // If we run past the bottom of the screen, abort macro. If Variable %N48% > 720 Text Box Display: Screen limits exceeded Macro Stop End If Delay 15 Milliseconds If Mouse Cursor is Beam Else Repeat Exit End If Repeat End //
  15. With complex macros I have built in many logging commands for debugging, but usually have a switch I can turn on or off so the logging is bypassed under normal situations -- just turn it on when I am having a problem. I have never used Log All Commands -- seems like it would be useful in some cases, but extremely time-consuming to read through the trace looking for a problem. For a macro that runs really long or really frequently, I would fear the performance impact. For one that runs only once in ten minutes, like you describe, minimal impact to write a few or a few hundred lines to the text log file. Note I only recommended that, as a start, you scatter some log commands through the macro to isolate the general area where it is hanging up. Sounds like you have made a good beginning by determining that the problem is not with the scheduling component of ME.
  16. I’m confused. You say the macro “fails to run”. Do you mean that the macro fails to start; or that it starts but fails to accomplish the intended file save? Those are two very different issues. I have found scheduled macros start reliably. All my macros have this as the first line: Log Message to Default Error Log where the “message” logged is the macro name. So it is very easy to look back on the ME log and see every time it starts. You could easily embed additional log messages at critical points in your macro to see how far it gets before hanging, if that is what is happening.
  17. Yes, same here. Then a macro ran more or less constantly scanning screens to see whether the pixel colors/positions matched with the coordinate file. That would identify which screen was visible, and call other macros to process the screen. Users with slower computers told me they didn't like it because whenever that application was running the CPU cooling fan would come on and make too much noise.
  18. Anchor points -- excellent idea. The script to record anchor points shouldn't be too hard to write. I have done something vaguely similar to record pixel colors of unique points on a series of identically-named web screens, so a subsequent macro can determine which specific screen is currently present. I found the easiest method was to position the mouse by hand, then trigger the recording macro via a keyboard key. If I positioned the mouse then clicked, the clicking jiggled the mouse just enough that I often recorded the wrong location.
  19. acantor sounds pessimistic, but he is absolutely right. The best Macro Express can do with Windows and especially web forms, is to be almost 100% reliable. It is great for automating personal tasks at work -- I always said it was worth half a person as a time saver. You can even roll it out to dozens or hundreds of users, but not to dummies. You/they have to watch carefully as the macros run and recognize when ME has gone wrong.
  20. Variable Set Integer %N1% from Position of Text in Variable %T1% (search for "user with code ") That gives you the displacement within the variable of the text "user with code ". Add 15 to the value in N1, and you have the starting position within the text of the two-character code. Extract the characters into another variable with Variable Modify String: Copy Part of %T1% to %T2% (starting position N1, characters to copy 2) If I have misunderstood what you want, then give us some examples of text you are working with, and the codes you are trying to isolate.
  21. I have done the same as Cory on some screens. Sometimes on a web page I will start with Alt-d to highlight the URL, because that also positions the cursor at the URL and gives a known starting point for tabbing. Of course, whoever maintains the page might also change the number of tabs needed. But you can diagnose and fix that fairly quickly when it happens, with the judicious use of Macro Stop statements inserted temporarily to see where the tabbing has left off. Sometimes if I can position the mouse fairly close above or below where I know the button will be, I write a short Repeat loop to move the mouse down or up a few pixels at a time, checking after each move to see if the mouse pointer has changed from an arrow to a finger. That works pretty well but sometimes fails due to timing, Windows busy doing something else so not changing the pointer quickly enough for example.
  22. Define an array variable rather than individually-named text variables. Increment an integer variable and use it as the index to the array.
  23. I don't know about holding a key -- can't think how that would be done. But you might be able to toggle as follows; it is essentially the same solution as you came up with in AutoHotKey. 1) User starts Macro A with a keystroke (the toggle key). 2) Macro A runs Macro B and ends itself. 3) Macro B records current mouse position (A,B) (vertical component B is all that counts). Macro B then loops continuously (Repeat loop), with a very short delay in each iteration of the loop, a few milliseconds. Each time through the loop it resets the vertical component of mouse position to whatever the starting position was. That is, if current mouse position is found to be (x,y) the macro moves the mouse to (x,B). So the user is able to move the mouse both horizontally and vertically, but the vertical movement is almost instantly cancelled by Macro B. 4) User again starts Macro A with a keystroke (the toggle key). 5) Macro A determines that Macro B is already running, and stops Macro B. Worth a try, fairly simple to code. Don’t know what impact it will have on CPU usage due to the looping – probably OK. On my PC the resulting mouse movement is kind of choppy, which may or may not be acceptable to you. Variable Set String %T1% "2" Get Mouse Position Screen: %N1%, %N2% Repeat Until %T1% = "1" Get Mouse Position Screen: %N1%, %N3% Mouse Move Screen %N1%, %N2% Delay 1 Milliseconds Repeat End
  24. I think you are almost there, but you missed the whole point of FIRST loading the entire text file into a single variable, then using a Repeat loop to process the spreadsheet rows one at a time. Here's your script modified a little: Text File Begin Process: "list-a.txt" Variable Modify String: Trim %T1% Variable Modify String: Append %T1% to %T2% Text File End Process * at this point the whole file is stacked in variable T2 Repeat Until 1=2 (in other words, repeat forever until the IF statement results in Repeat Exit) Clipboard Copy If clipboard = “” (nulls – all spreadsheet have been processed) Repeat Exit End If Variable Set String %T3% from Clipboard Variable Modify String: Trim %T3% If Variable %T2% contains variable %T3% Text Type: <ARROW RIGHT><DELETE><ARROW RIGHT><DELETE><ARROW RIGHT><DELETE><ARROW RIGHT><DELETE><HOME><ARROW DOWN> Else Text Type: <ARROW DOWN> End If Repeat End
  25. I think this approach will work: Use Text File Begin Process, once only, to load all entries from the file into a single text variable. That is, read the file one line at a time into T1, trim, and append its 9 characters to T2 (variable modify string/append), continue until the whole file has been loaded. When done, T2 will be an array of 9-character strings. (But you won’t need to process it as an array – see below.) Next, copy the first spreadsheet cell into the clipboard, store in text variable T3. Command If Variable %T2% contains "%T3%" tells you whether the array (file) contains that cell’s data, and you can type or delete into other cells in the row as desired. Text Type of arrow keys is good for moving from one spreadsheet cell to another. Get this working for a single row of the spreadsheet. Once you have it working for one row, add Repeat Start and Repeat End to handle all the rows one by one. Use Repeat Exit when you reach the end of the spreadsheet (that is, when copy to clipboard finds nothing).