Jump to content
Macro Express Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


rberq last won the day on April 18

rberq had the most liked content!

Community Reputation

14 Good

About rberq

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Clever workaround. I used to have a great programmable keyboard that could do something like that -- one key would send keystroke combinations or sequences, so I could start macros by a single keystroke rather than by using both hands and a whole bunch of fingers simultaneously. It's good to know that AHK can do this, and I'm also at a loss as to why it can intercept but ME can't.
  2. For small amounts of text, it is practical to use Text Type to type the text in from a variable. Typing will be slower than using the clipboard, but perhaps more reliable and predictable. Just don't set the keystroke speed so fast that the "typing" overruns how fast Windows and the application can accept keystrokes. Keystroke Speed: 10 Milliseconds There is a Macro Express "Preference" that applies an automatic time delay after each ME clipboard action. I haven't found it very useful, because to rely on it you must set it for the worst possible case (longest delay you will EVER need), and that will penalize the many macros that need very short delays. Probably better to use a delay command following the clipboard command, as you did, because you can tailor each delay to the particular situation.
  3. Clipboard copy and paste are Windows functions, and Macro Express can't really tell when they will finish. They can be problematical in macros. After all, ME is simply entering the Ctlr-v to paste, like you would enter it from the keyboard. Doing it manually, you watch the screen and naturally you don't go on to the next step until the pasting is complete. But ME has no inherent way to watch for completion, unless you program it into your script. Depending where the data is copied from, and where it is going, Windows does lots of work to format it for the target location. For an example, go to this web page, do Ctlr-a to highlight the whole page including images, Ctrl-c to copy, then Ctrl-v to paste into Microsoft Word. On my machine, the paste takes almost three seconds. https://forecast.weather.gov/MapClick.php?lat=41.7638&lon=-72.6739
  4. I don't fully understand what you are doing, but I wonder if the macro is typing things faster than the application or web form can accept them. You could try putting a one second delay between each TYPE command, and see if the problem goes away. Then start removing the delays, one at a time, until you determine which one(s) are overrunning the application.
  5. I think it's a good idea to embed a time delay within almost every loop. If the macro is watching for a screen change, I usually use a 100ms delay -- 1/10 of a second -- on each pass through the loop. That provides almost instant response in terms of human perception. It also makes it easy to specify how long the repeat loop will run. For example, if you want it to keep repeating for 10 minutes, then 600 repeats with 1-second delays will in theory accomplish that. Or 6,000 repeats with 1/10-second delays. When quick response is not an issue, I have macros that wait 10 or 15 seconds during each repeat. A repeat loop with no embedded delays can eat up a lot of processor power for no particular benefit.
  6. I think Wait For Time to Elapse is pretty accurate. Before starting the repeat loop in the primary macro, set some flag, like maybe store zero in an environment variable. Then start a second macro which does the Wait For Time, and changes the variable from zero to one at the end of the delay. In the primary macro's repeat loop, check the variable and exit from the repeat loop when it becomes one rather than zero. You can check the variable every time through the loop, or every tenth time or hundredth time or thousandth time depending on the precision you want and how rapidly the repeated code executes. Make sure the two macros are allowed to run simultaneously. You can check how accurate the Wait is with a simple two-line macro, comparing to a wall clock or stop watch or whatever: // Wait Time Elapse: 0 Minutes 22 Seconds Text Box Display: time over //
  7. I have had enough weird troubles with "<control>character", and with "<alt>character", that for years now I haven't even bothered with trying them. I ALWAYS use the separate <down> and <up> sequences, and they always work. And yet other people insist the simpler sequence works fine for them. Go figure.
  8. Try some method other than "MacroRun" for Macro2 to start up Macro1 -- for example, by having Macro2 create a file and starting Macro1 based on the Directory Modification trigger. Or (simpler) start Macro1 when Macro2 places some unique data into the Clipboard. Either way, the triggering of Macro1 by Macro2 will be asynchronous (I like that word) to whether Macro2 keeps running or not, so you should be able to terminate Macro2 immediately after creating the trigger. Clipboard trigger seems simpler, as long as it doesn't interfere with other stuff that is going on, either within or outside of Macro Express. Draw a little flowchart, so when you come back to these macros six months from now, you will remember what the heck you did. 🧐
  9. Yes, the time-consuming thing seems to be getting the data into a ME variable. Scanning for "contains" is very fast. You built your 600K test string about the same way I did. So I guess I can't get you to hire me starting at one penny a day, if you will double my salary every day for a year.
  10. My processor is Intel Core i3-2370M CPU @ 2.40GHz 2.40GHz. I don't know what that means. Here's the ME routine I tested with. I built a Notepad document so I could easily modify the number of characters for tests. The first couple lines, copying to clipboard, took no more than a second or so, even with 500,000 characters. Setting string T1 from the clipboard took many seconds, maybe 15 or 20 seconds, with 500,000 characters. Very fast with only 5,000 characters. Displaying the "release" text box allows estimating the actual scan time (your code) -- that is, from the time I hit ENTER to close the "release" box, until either the "contains" or "contains none" box appears. So, to finally answer your question, your code runs almost instantaneously whether I start with 5,000 characters or with 500,000. I used Macro Return rather than Macro Stop like you did, but I doubt that matters much. // Text Type: <CTRLD>a<CTRLU> Macro Run: 0_Generic_Copy_To_Clipboard Variable Set String %T1% from Clipboard Text Type: <END> Text Box Display: release to start process Variable Set Integer %N1% to 0 Repeat Until %N1% > 9 If Variable %T1% contains "%N1%" Text Box Display: contains Macro Return Else Variable Modify Integer: Inc (%N1%) End If Repeat End Text Box Display: contains no digits Macro Return //
  11. Yeah, I saw your logic flaw but I didn't want to be obnoxious by pointing it out. So I'm being obnoxious now, instead. 🙃 If your macro is scanning 1.2MB almost instantly, your PC must be faster than my 7-year-oldie. Either that, or ME Pro maybe isn't doing the IF CONTAINS the same as ME 3.
  12. The only problem I recall with long string variables, was saving them in Environment Variables. I think I hit a problem at 8,192 bytes -- but I don't really remember for sure.
  13. See my suggestion above. Because the ASCII codes for all letters are grouped in a single range, you can code two IF statements instead of twenty-six. I think that will work. Variable Modify String (the one character you are examining) to upper case IF character greater than or equal to A AND IF character less than or equal to Z then it is alpha END IF http://www.columbia.edu/kermit/ascii.html
  14. It's odd your script would fail with long strings. I tested it with a string over 400,000 bytes long, with digits near the very end. (Though I ddin't use a Repeat loop, just hard-coded multiple IF CONTAINS statements.) It took awhile to run, but worked fine. Timeout of some sort, maybe?
  15. For that to work, I think there is a limit to the size of the integer. For example, the lines below always return "01234567899" in the Text Box Display, once the Set String exceeds 10 digits. Comparing the string to the integer would not result in an equal condition. Variable Set String %T1% "0123456789987654321001234567899876543210012345678998765432100123456789987654321001234567899876543210" Variable Modify String: Convert %T1% to integer %N1% Text Box Display: %N1% I think your best bet is the "annoying way" that Cory originally suggested. if the ONLY special characters that can be there are "[" and "]", the job is simpler. If ME had commands for inclusive OR, exclusive OR, and AND, for string variables of different lengths, it would also be simpler. But it's an interesting question. I will keep trying to think of an ingenious solution. 🙂
  • Create New...