Jump to content
Macro Express Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by rberq

  1. The brute-force method comes to mind. Set up a macro to do the following: First run the DOS dir command sending output to a text file: Launch c:\windows\system32\cmd.exe and pass it parameter /C dir c:\targetdir > c:\temp\dirlist.txt Then open c:\temp\dirlist.txt with Notepad: Launch c:\windows\system32\cmd.exe and pass it parameter /C c:\windows\system32\notepad.exe c:\temp\dirlist.txt Text Type CTRLD - END - CTLRU to take you to the end of the file. Text Type a string of nines or ampersands or something that you can recognize as a stopping point in the REPEAT loop below. Text Type CTRLD - HOME - CTRLU to take you back to the beginning of the file. Now process each line of the file; REPEAT START Highlight and copy file date parts into clipboard and from there into three Txx text variables (month day year) Check whether your Txx variables contain your end-of-file marker (ampersands or whatever you inserted above) -- if so, exit from the REPEAT loop) Compare the month day year variables to your purge date If date is within the purge range, ARROW RIGHT to where the file name is displayed, highlight and copy name into the clipboard and from there into a text variable, construct a DOS delete command in a text variable Txx, launch the delete command: Launch c:\windows\system32\cmd.exe and pass it parameter /C del %Txx% Text Type HOME - ARROW DOWN to get to the next line in your file REPEAT
  2. I had a similar situation, and I could not find a ME command to fire a macro when a control is clicked. There IS an option to fire a macro when a control gains focus. If clicking causes focus, this might work for you, but you probably would need a separate macro for each and every control, whose only function was to run the "real" macro. There's also an option to fire a macro when you click within an area on the screen based on rectangular coordinates. I have used that. The problem with that was, that clicking on the Exit button shut down the whole application, and the window closed before the macro could run.
  3. For debugging, try putting a Text Box Display after the IF, to make sure the IF is being satisfied the way you think it is. I don't know how the macro is being launched, so I'm not sure why ME would "make a run through the macro however many times the window is active". I doubt that the problem has anything to do with lines being dropped from memory.
  4. "Hidden" and "Minimized" options of Launch Program seem to have no effect. I thought there might be a command-line option for Excel to open minimized, but no, can't find one. The best I could do was launch it and then immediately minimize it. And that doesn't help with your refresh pop-up. I'm stumped!
  5. Try launching notepad to open the text file. (Launch "C:\Windows\system32\cmd.exe /C notepad.exe textfile.txt") Then Text Type keystrokes to find the id within Notepad: ALTD-E-ALTU, F(ind), %T1% as the find argument, ENTER. This should position you at the correct line within the text file, if it exists. Text Type the HOME key to assure you are at the beginning of the line. SHIFTD - END - SHIFTU to highlight the whole line, copy to clipboard, save clipboard to another variable like T2. Change variable T2 by editing out the numeric digits (and maybe the Tab character?) -- changing them to nulls or spaces. Compare T1 to T2 to make sure you really found what you think you found (in case the name is not in the file at all). Text Type HOME again, then END, to position to the end of the line after the numeric digits. Text Type SHIFTD - ARROW LEFT as many times as the number of digits - SHIFTU to highlight the digits, copy into clipboard, save in a variable like T3. This will be easier if you standardize the number of digits -- that is, the text file should contain SALLY 009 GEORGE 010 rather than SALLY 9 GEORGE 10 Close notepad, switch to the screen where you have to do the tabbing. REPEAT %T3% Text Type Tab REPEAT END I have probably missed a detail or two, but you get the picture....
  6. Macro1 initiated by mouse click, toggles a variable between 0 and 1, runs Macro2 when toggling from 0 to 1. Macro2 checks variable toggled by Macro1. If variable=0, stop. If variable=1, do the keystrokes, run Macro2 (i.e. restart itself), stop. So the first mouse click will fire off the operation, which will continue "forever" with Macro2 running then immediately restarting itself. Second mouse click will trigger Macro1 to run again (between iterations of Macro2) and flip the variable back to 0, so on its next iteration Macro2 will terminate itself. I think the above will work. You may have to "save" the variable at the end of each macro, and "restore" it at the beginning of each, so that each macro will see what the other has done.
  7. On my keyboard, if Num Lock is on and you have a macro type Shift and 7 on the keypad, it will type 7. But with Num Lock off, Shift and 7 will type nothing (it is the Home key). (Note that MacroExpress in this case performs differently than the native keyboard entry -- so this solution may be relying on a bug in ME, or maybe my keyboard is just different from others.) In MacroExpress you can "press" the keypad 7 by using the "Misc Keys" section of Text Type. So, (1) Launch Notepad (2) Text type <SHIFTD><KEYP7><SHIFTU> (3) Text type <SHIFTD><ARROW LEFT><SHIFTU> which will highlight the character you just typed (if any) (4) Insert the highlighted character into the clipboard and from there into variable T1 (5) Check the value of T1. If it is 7, then Num Lock must be on. If it is blank or null then Num Lock must be off. Check other recent forum postings. You may be able to do the Notepad interactions invisibly, that is without Notepad coming up as the top window and obscuring your altimeter or your Gatling Gun controls or whatever.
  8. Could you be a bit more specific? Are you searching for specific text wherever it may be? or just trying to get to a specific field (like, say, the 7th one on the form) and see what data is there? What kind of window -- DOS, standard Windows, Internet page?
  9. I have done it both ways. Tab to field, copy to clipboard, store clipboard in variable for later use, repeat for each field. The gotcha here is to make sure you are on the right field to begin with, which may take a little experimenting with what scripted keystrokes will reliably get you there. The better method IMHO is to use Get Control, which you have to set up manually for each field on the form, and when the macro runs the information about each control is stored in variables C1, C2, etc. Then to capture the data entered by the user (or displayed by the program), you do Variable Get Control Text to retrieve the data into text variables. This has several advantages: (1) data capture works even if the field is grayed out and/or you can't tab to it, (2) data capture seems to me to be faster, (3) data capture does not affect (or rely upon) where the user has left the cursor, so it is potentially less disruptive to the user. Definitely worth your effort to go through the controls tutorial mentioned above.
  10. The solution for clip.exe from macro express is probably the same as for attrib. That is, Launch program/path: C:\windows\system32\command.com Program parameters: /C dir c: | clip I haven't tried it because I don't have clip.exe on this PC.
  11. WORKING OK ON DOS COMMAND LINE: attrib > c:\type_attrib_to_file.txt NOT WORKING on macro express , program parameters of LAUNCH program instruction : code: <LAUNCHDEL2:0:01C:\WINDOWS\system32\attrib.exe<PARAM>> c:\type_attrib_to_file.txt3> ----------------------------------------------------------------------------------------------------------------------------- I beat it into submission as follows: Launch command.com instead of attrib.exe. Pass attrib.exe to command.com as parameters. Like so: Launch program/path: C:\windows\system32\command.com Program parameters: /C attrib >c:\temp\metest.txt Or, in direct-edit format: <LAUNCHDEL2:0:01c:\windows\system32\command.com<PARAM>/C attrib >c:\temp\metest.txt> though why anyone would want to use direct-edit is beyond me. Bob
  12. Thanks to both of you. I used the write-a-file method just because I'm more used to that than to playing with the registry.
  13. From Visual Studio .NET I use Process.Start, to start either meproc.exe or macexp.exe, passing it the name of a macro. This is working just fine -- the macro runs with either program. However, I want my Visual Studio program to wait for completion of the macro. I can get the names of processes running on the PC with Process.GetProcessesByName, and I can Process.WaitForExit to know that a process has exited. However, it does no good to wait for meproc.exe to finish, because that program only tells macexp.exe to run the macro and then ends before the macro runs. Likewise it does no good to wait for macexp.exe to exit, because it seems to exit at random times that have nothing to do with whether my specific macro has finished or not. Suggestions, anyone?
  • Create New...