Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. I'm stumped. I played with your macro for half an hour, and I get the same result you do. It's as if the IF statement were not there at all (or always results in a not-equal condition). I displayed the variable values in a text box immediately before the IF. I changed the "if not-equal" to "if equal" with an "else". I moved the array elements to the old T[xx] variables and displayed those and compared on those instead of on the array elements. I trimmed the elements before the compare. No matter what I do, the output file is simply a copy of the input. Either there's something seriously wrong with Macro Express, or you and I are both missing a really stupid error in the logic. I think YOU should report it to Insight as a bug, so I don't have to take the hit for a dumb question.
  2. Are you clearing your output file between tests? Duplicates left over from an earlier test, maybe?
  3. The logic looks like it should do the job of removing consecutive duplicates. However, that's not the same thing as removing ALL duplicates, and it will not sort the array.
  4. When you type the ENTER key in notepad to end a line, what is actually inserted into the notepad file is a two-character sequence Carriage Return / Line Feed. These are ASCII character values of 13 / 10. So instead of splitting on <ENTER>, first set two one-character string variables like so: Variable Set to ASCII Character 13 to %CRLF% Variable Set to ASCII Character 10 to %LF% Then append the LF to CRLF to make a two-character string variable, %CRLF% Split on %CRLF% rather than on <ENTER> <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CRLF%"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%LF%"/> P.S. Your plan to activate the macro based on the window gaining focus, should work nicely. You will still have the issue of figuring out whether one line has been added since last time, or more than one line. Cory and I suggested ways to do that in your previous thread.
  5. You say you can use the XP clipboard viewer to save the contents of the clipboard to a file, and you can view that file in Notepad. So, maybe you could write a macro that uses ME commands to: 1) launch the XP Clipboard Viewer 2) type the keystrokes needed to save clipboard contents to a file 3) open the save file in Notepad 4) copy from the Notepad screen into the clipboard 5) parse the new clipboard data and extract the file name and path Steps 3 & 4 might be replaced by simply reading the save file into a ME variable. Step 5 might be very easy, or it might be the trickiest. It depends on what "garbage and shell extensions stuff" surrounds the data you want to extract. If you are not familiar with using ME to parse strings, post an example of the data you see in Notepad, and we can probably give you advice on how to do it.
  6. A macro fills out a form. Some fields on the form have drop-down lists. If I do the form manually and tab into a field, the drop-down list does not open unless and until I start typing characters. When ME3 tabs into the field, same thing, the drop-down list does not open unless and until the macro starts typing characters. I converted the ME3 macro to ME Pro. When MEP tabs into a field, sometimes the drop-down list appears regardless of typing, sometimes it does not appear until the macro starts typing -- it is inconsistent from one time to the next. In testing MEP, I have seen this difference on several fields of several forms. I can code around the problem, but I'm really curious what accounts for the difference. Ideas, anybody? Thanks.
  7. Variable Set String T99 = www.macroexpress.com/ Variable Modify Integer [convert N1 integer to a string, for example into T1] Variable Modify String [append T1 to T99] There are lots of goodies hidden in the "Variable Modify" and "Variable Set" commands for strings / integers / decimals.
  8. Yes, this can work well. You can write a simple macro to get current mouse position and append the x-y coordinates to a file. So you "learn" each screen once by positioning the mouse manually and firing off the macro with a hot-key combination. Or, have a repeat loop in the macro so it waits for you to click the mouse and gathers the coordinates after each click. Be very careful not to move the mouse while the macro is getting mouse position. The command takes a "significant" amount of time, and if you move the mouse at all you may wind up recording the wrong coordinates. If you want to get fancy, collect the pixel color at each point where you collect mouse coordinates. Then your playback macro can verify that it is really in the right place before it clicks, and warn you if things get out of sync.
  9. You should be able to code it almost exactly as you have written it in English. Assuming that the pixel you want to check is at coordinates 123, 456; and that the other position you want to click is at 987,654; then this should do what you want. Note that when coding Get Pixel and the Mouse Move commands, you will have to specify whether the coordinates are relative to the whole screen, or relative to the window that has focus. Repeat Start (Repeat 2 times) Get Pixel: Window Coords: 123,456 into %N1% If Variable %N1% <> 123456789 Mouse Move Window 987, 654 Mouse Left Button Click Mouse Move Window 123, 456 Mouse Left Button Click End If Repeat End Here's the same macro in code format -- you should be able to copy and paste this right into the script editor, and experiment with it from there. <REP3:01:000001:000001:00002:0:01:><GETPX:1:W:000123:000456><IFVAR2:2:01:2:123456789><MMW2:987,654><LCLK><MMW2:123,456><LCLK><ENDIF><ENDREP>
  10. Copy and paste this into your macro. It simply does a left-button click, wherever the mouse button is at the time the macro runs. <LCLK> There are other macro commands to move the mouse. You don't need those commands, because you said you will manually move the mouse, rather than have the macro move the mouse. For those, you need to tell the command where you want to move the mouse to. These require that you enter coordinates. They also require that you say whether to move relative to the whole screen, or relative to the active window. Maybe it is one of those commands that is confusing you with a bunch of options that you don't need.
  11. Report it as a bug. I came across a couple of conversion issues which were quickly fixed after I reported them.
  12. If by "cursor" you mean anywhere you put the MOUSE POINTER, your macro can consist of the single line "Mouse Left Button Click". Use the Schedule feature (Properties tab of the macro) to have it run every 4.5 minutes. Wherever the mouse is when the macro runs, that's where it will click. If you move the mouse somewhere else during the 4.5 minute interval, it will click at the new location next time it runs. If by "cursor" you mean a text cursor, then I don't know ....
  13. You could schedule your macro to run every ten seconds, more or less. First thing the macro does is check what time it last ran. If less than a minute or two since it ran, record the current time (maybe in a file, or an environment variable), and exit with no other action. If more than a couple minutes since it last ran, then assume the long delay was due to suspension or hibernation, so record the current time and do whatever else you want it to do. Someone else may have a more elegant method, but the above should work with either ME3 or ME Pro.
  14. When you drag the cross hairs over your target, does it "light up" with heavy black lines around it? If not, then it's probably not a capturable control.
  15. I'm kind of shooting in the dark here, because I haven't had a lot of success with controls except in one application. I wonder if your TradeStation application creates its child windows anew each time it runs, so that the identifying control information is different each time? Then, since your macro points to the controls as they existed when you coded the Get Control commands, the macro will not find the "new" controls. There is a Capture Control command, apparently intended to retrieve the identifiers for each control at macro run time, as opposed to Get Control that retrieves the identifiers at macro coding time. One option of Capture Control is to work with the control under the mouse. So, if TradeStation puts its child windows at predictable locations on the screen, perhaps you could have a one-time routine to Capture (once a day, say, after you start TradeStation) -- and use that information for the rest of the day rather than using Get Control on each pass through your macro. Like I said, my experience with controls is minimal, so all the above may be based on ignorance rather than reality. Let me know if it helps....
  16. That's why Cory and I suggested keeping track of the last line processed, so your macro will adapt automatically to one or many lines dumped into Notepad since the last macro execution. My suggested method avoids arrays, Cory's uses arrays. Otherwise the techniques are largely the same. Arrays would likely be faster, but whether the extra speed buys you anything in the real world, I don't know. The file method has the advantage of surviving restarts of ME or reboots of the PC without losing any data -- you could do that with arrays also by saving the data somewhere, but it's not quite as straightforward. Might be useful if you can send it directly into a file. All the file processing can run in the background without interacting with a visible window. If you can use Cory's suggestion of pasting into the target window via Windows controls, then there would be nothing to disrupt your hands-on use of the PC. If your stock ticker can only redirect into an active (on-top) window, then it doesn't buy you much.
  17. The tricky thing is determining which lines are new when your macro runs. Here's a process to try. You have a file A that another program is dumping lines into. Make sure it is empty at the beginning of the day. Do NOT open this file in Notepad. You will use text files B and C which should not exist when you start the process (beginning of the day, perhaps). B and C will be created automatically when the macro appends lines to them. Write a macro and schedule it to run every few seconds. The macro will: 1. Use Text File Process to read B from beginning to end, counting the lines. 2. Use Text File Process to read A from the beginning, counting the lines and comparing the count (at each line) to B's count. 3. Any line in A which was not in B (based on counters) you will append to both files B and C. (ME command is Variable Modify String [Append to Text File with CR/LF]). 4. When you reach the end of file A, the new lines (since the previous macro run) are in C. All lines since the beginning of the day are in both A and B. 5. Use Text File Process to read C from beginning to end. For each line, activate the window where you need to paste it, do the paste and the other arrow and mouse actions. 6. When you reach the end of C, delete file C. (The next scheduled run of the macro will create it again if there are new lines.) Edit: if the stock-quote program is truly dumping lines into a Notepad window, rather than into a file, then each time the macro runs its first step would be to activate the Notepad window and execute the keystrokes to save Notepad to file A (Alt-File-SaveAs-A-ENTER).
  18. I'm guessing you can't really "ignore" these pop-ups, as you say, but that you have to do something to close the pop-up. If your macro is launching the main application, then about all you can do with ME3 is delay for some period of time after the launch, and look for the pop-up window titles with "If Window", like Kevin suggested. Then you can type ENTER or mouse-click the OK button or whatever to close the pop-up if it has appeared. The drawback of this method is that you have a finite delay, before the main application can be processed, regardless of whether the pop-up appears or not, because you just have to wait and see what appears. If the pop-ups don't have unique window titles, there are other tricks that can be used, so post a follow-up if that is the case.
  19. Paul's use of the Windows registry has the advantage that you load the value once, and it stays there indefinitely through reboots and restarts of ME. If you don't want (or aren't allowed) to change the registry, you can do almost the same thing by scheduling a macro to run at ME startup. In the macro you save the disk drive to an environment variable. All your other macros simply read back the environment variable. When you move to a different PC, you simply change the startup macro to whatever fits that PC. If you use Paul's Control Panel / System / Advanced method of creating an environment variable for .BAT files, then (after a reboot of Windows) it becomes accessible to ME as an environment variable as well. It also survives reboots and restarts of ME. (I didn't know that until I tested. In fact I didn't know about the Control Panel way to create the variable until I read it here -- Thanks, Paul.)
  20. With ME3 only one macro can run at a time. Is it possible that another macro is running when the scheduled time arrives? If so, ME will not queue up the scheduled macro -- that is, the scheduled macro will not run when the interfering macro ends.
  21. Here's one way to do it: Generate a random integer between zero and fifty-nine. Store it in an environment variable; or in a file if you want it to survive shutdowns and restarts of ME. Schedule a macro to run every minute. The macro will: 1) Retrieve the stored number. 2) Compare the stored number to the current time (minute only). 3) If stored equals current, click the mouse, generate and store another random minute for the next click, exit. 4) If stored not equal current, exit without doing anything.
  22. Put your data into variable T1, then REPEAT UNTIL T99 <> T99 (i.e., forever) IF T1 CONTAINS "text string" do keystrokes and ME commands ELSE REPEAT EXIT REPEAT END MACRO STOP
  23. Cool. I'll have to try that. So when you tell it to convert a string to an integer, it goes and finds the first string of digits and discards everything else?
  24. Sorry, I thought you said the number of digits would always be the same. Once the string of digits is at the beginning of the T1 variable, Variable Modify String T1 copy about 50 characters to T2 -- copy more than the largest number of digits you expect. Then write a repeat loop to step through the T2 characters one at a time checking whether they are numeric or not. Keep a count of how many characters are checked, in another Nx variable. When you finally get to a non-numeric, delete that and all subsequent characters from T2. What you are left with in T2 is just the numeric digits. Repeat the above to isolate the second string of digits into T3. It's a good idea, before starting this second process, to append a space to the T1 variable, so that you will be sure of finding a non-numeric (the space) before you come to the end of the T1 variable (in case the digits are the last thing in the URL). There are other ways of extracting the digits, one at a time, into T2 and T3; but the above should work. There may be a simpler method than stepping through the digits one at a time, but I don't know what it is.
×
×
  • Create New...