Jump to content
Macro Express Forums


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by rberq

  1. Shortcuts extremely slow

    How slow is slow? 1/4 second response, 4 second response, what? Also, when Macro Express is running, are there any long-running macros or resource-intensive macros that could be sucking up processor time? With ME running, if you go into Windows Task Manager, can you see any processes using a lot of resources -- CPU, disk, memory?
  2. I think you are on the right track, and I see no reason why your approach shouldn’t work. Your fixit macro should be able to do all the following with keystrokes (which are easier than figuring out where and when to click the mouse). Be sure to insert reasonable time delays between the Text Type functions, so your commands don’t outrun the Explorer and Editor functions. Set Keystroke Speed to a reasonable value. Arrow down (in Explorer) to next macro. Enter (to edit the macro). Alt-v followed by i to enter the Direct Editor. Ctrl-R followed by appropriate values to set the replacement, followed by Tabs to highlight the Replace All button, and ENTER to do the replacement. ESC a couple times to close the replace dialog box and the “not found” box if any. Alt-s followed by l to save/close/return to macro explorer. Like Cory said, don’t rely on magic numbers. No way would I start this macro and ask it to run 545 times. Too much can go wrong, mostly in terms of Windows timing, and once your macro is out of sync with ME Explorer, who knows what havoc you may wreak? I’d suggest making a good backup of your macro file, and letting the macro repeat ten or twenty times maximum, requiring you to restart it for additional iterations.
  3. Integer seconds to yyyymmdd-hhmmss ?

    Yes, I did include a sample script in the post. MsgBox(DateAdd("s",30,"31-Jan-10 08:50:00")) is a complete script. That one line is the entire text (script) file that my macro built. The display is NOT a Macro Express message box, it is a VBScript message box. A macro was used only to write that one line to a text file, to save the text file with the .vbs filetype, and to launch Windows WSCRIPT.EXE which runs the script file. You can simulate this manually by building and saving the one-line script file with Notepad, then typing "WSCRIPT.EXE filename.vbs" at a command prompt or the Windows "Start" command. For your purposes, a message box output is useless, so do some Googling and copy/paste file-building logic so that the (1) macro builds a bigger script, (2) the macro launches WSCRIPT to run the script, (3) the script writes the computed date result to a (second) text file, then (4) the macro retrieves the text file containing the result. It seems convoluted, but after you get it working you may come up with a simpler method. In my mind, the biggest advantage of using VBScript is that Microsoft has already written hundreds or thousands of lines of code to make DateAdd do accurate calculations that span day-end, month-end, year-end, etc. P.S. Getting familiar with Visual Basic and similar object-oriented languages IS painful for somebody used to step-by-step logic. I have suffered through it and have very far to go, probably will never get there at my advanced age. But it is worth it, so get going. Google is your friend.
  4. Integer seconds to yyyymmdd-hhmmss ?

    This isn't two lines, but it's not many: Macro builds a text file containing the VBScript command DateAdd, with the appropriate number of seconds added to the date/time that the macro provides. For example: MsgBox(DateAdd("s",30,"31-Jan-10 08:50:00")) adds 30 seconds to the starting date/time and displays it in a pop-up message box. That one line is the entire text file that the macro must build. Macro saves the text file as testscr.vbs Macro uses the Program Launch command to run wscript.exe, passing it “testscr.vbs” as its parameter. This can be done easily with ME. It has the advantage that Microsoft’s VB Script language does all the date calculations for you – no small matter when you consider leap years, leap centuries, additions that take you from one month or one year to the next, and so on. I have used MsgBox for my example, and you can use it for testing. But for your live macro you will probably want to find a different VBS function that sends the result to another text file where you can retrieve it further down in your macro – or sends the result to some other easy-to-access location. I don’t know what VBS function to suggest, but starting from abject ignorance (almost) I got this far in half an hour, so you can take it from here. Keep us posted.
  5. A scheduled macro never runs

    I remember that "Play macro indefinitely" because I also omitted for my first repeating macro, and that was my whole problem.
  6. Probably what you see on the screen is Macro Explorer, which lists all your macros and allows you to double-click to edit them. Macro Express runs independently of Macro Explorer. Macros can run regardless of whether you have Macro Explorer active or not. At the top of the Macro Explorer screen, select Options | Preferences | Appearance. Set Show in System Tray and a block letter "M" will appear when ME itself is running, regardless of whether Macro Explorer is running or not. If you have ended Macro Explorer, you can restart it by clicking once on the system tray icon. Or right-click the icon to get a list of options, such as starting the Editor (Macro Explorer), terminating Macro Express (AND Macro Explorer if running), etc. Options | Preferences | Startup also allows you to specify whether Explorer (also called Editor) is to start (or not) when Macro Express itself starts.
  7. A scheduled macro never runs

    Can you post a screen shot of the Set Schedule box for your macro? Also what did you specify in the Scope tab for the macro? Also ME Options | Preferences | Scheduler settings?
  8. Speed It Up, or Slow It Down

    Set your scheduled macro to run every second or two seconds. Adjust ME preferences so the Scheduled time is at least as short as the macro's interval. When your scheduled macro runs, check an environment variable or something of the sort which contains your preferred page-turn interval. Based on time, if the interval hasn't yet elapsed, don't hit the page down key. Write two new macros triggered by the (+) and (-) keys, who job is to bump up (or down) the page-turn interval stored in the environment variable. Instead of checking time, you could hit page down every time through the scheduled macro, or every second time, or third, or tenth or whatever. Or have a never-ending macro that loops indefinitely (Repeat loop) with an embedded adjustable delay each time through the loop. Still requires storing some sort of status or interval by means of other macros triggered by (+) and (-). But why would you want a feature like that? Reminds me of a speed-reading class I took, where a sliding shutter came down over the page line by line to force you to stay concentrated to keep ahead of it. It worked, but reading was no longer any fun.
  9. Waiting for Key Press - more choices

    Since you are using a message box, could you instead use the "Multiple Choice Menu" Dialog? I do have a possible solution for the situation you as presented it, but it is way more complicated -- have your primary macro start two other concurrent macros, one that waits for A and one that waits for E, and code a Repeat loop in the primary macro waiting for a signal from either one of the waiting macros. You can wait for "Any key" to be pressed. It's too bad Macro Express doesn't insert the pressed key into a text variable -- then you could check whether it is A or E and re-issue the wait if not.
  10. Announcement: Macro Express v 3.11a

    Thanks for the notice. Still happily running ME version 3.
  11. ME essentially does keyboard actions and mouse commands, and they apply to the active window. So I don't think it can do what you want. For your sake, hopefully somebody will prove me wrong! If you have a dual monitor; or if you can shrink the Explorer window down to a small footprint that shares the screen with your active application, it could work. But your active window would briefly lose focus while Explorer is active.
  12. Yes, Sam. Simpler than my routine and should be just as effective. I still recommend trimming the remaining title.
  13. 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.
  14. Larger Region To Look For Color

    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 ....
  15. 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?
  16. Larger Region To Look For Color

    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
  17. Larger Region To Look For Color

    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.
  18. 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.
  19. This appears to be a duplicate post. Replies are in the other thread.
  20. 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).
  21. Excel data use

    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 //
  22. Sluggish Mouse Move?

    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.
  23. Wait for pixel color change config

    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
  24. Sluggish Mouse Move?

    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.
  25. Sluggish Mouse Move?

    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.