Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. Right you are, Kevin. I should have checked the Help screens!
  2. Don't apologize for your English. It is a lot better than my German! It will not be truly random, but you could use the TIME command (it is under TEXT), put the time into a variable, and use the rightmost digit of seconds as your delay. Change the digit to an integer (Nx) variable, and use that integer in the Wait Time Elapse command.
  3. I had never looked for date routines in ME; I'm surprised there isn't more built in. First, be aware that your IF T30 <= T31 often won't work right. For example, December 12, 2008 will appear to be later than, say, June 10, 2009, or for that matter later than ANY date up to December 11 of ANY year. You need to use Variable Modify String | Copy Part of String, to store your dates in two new variables in the format YYYYMMDD rather than MMDDYYYY. Then you can legitimately do a less than or equal comparison. From there, the only way I know to add to the date is by the brute force method, which is too long to go into fully here. Basically, convert the DD part of your date to an integer, add 7, check whether you have exceeded the possible number of days in the MM month (some months are 30 days, some 31, and don't forget leap year Februaries are 29 except sometimes when the leap year is a century turnover). Then bump month up by one if you went past the maximum days, and reduce DD days by length of the month just past, then do the same check for year in case you rolled the month from 12 to 13. It's a real pain -- maybe if you google "MacroExpress date conversion" you will find where someone has done it. It seems odd that, since ME allows you to go forward and back from current date, they didn't allow you to easily specify your own initial date. Here's another possibility to try: make and save an Excel spreadsheet where column A is date-formatted, and cell A2 = A1 + 1. In your macro, launch the spreadsheet, type your variable into A1, arrow down to A2, copy A2 to the clipboard, put the clipboard value back into your macro variable, close spreadsheet.
  4. Do you have access to the Access application, so you could give the message box a title? Or, along the lines that Stan suggested, try to capture the message box control, then check the text in the control. I'm not at all sure this will work, but something like this: If mainwindow not active Capture Control | Control Focused Variable Get Control Text to T1 If T1 = "message box text" Do Something End If End If
  5. I'm not sure I understand what you are trying to do. Will the names of the saved files consist ONLY of the numbers, or will numbers be appended to an existing name? Yes, putting the names of the existing files into a text file sounds like a good idea, then use Text File Begin Process loop to retrieve the names, generate new name, copy old to new with the DOS copy command. See recent topic, "Outputting numbers with leading zeros". You can use a technique like that to build the new filenames on the fly. Output numbers with or without leading zeros. Just concatenate the base filename with the generated number then do the DOS copy command as described above. If I have misinterpreted what you need, give us some more details and we can go from there.
  6. I haven't written the code, but something like this should work: Variable Set Integer N1 = 0 REPEAT UNTIL N1 greater than x (x is however many numbers you want to output) Variable Modify Integer N1 (add 1 to N1) Variable Modify Integer | Convert Text to String (N1 into string T1) Variable Modify String | Pad Left T1 width of 9 (pads T1 with leading spaces, total length of resulting string will be 9 characters) Variable Modify String | Replace Substring in T1, replace all instances of space with zero Output string wherever you want it to go REPEAT END
  7. With command Variable Set String / Set Value from Clipboard, you can save text from the clipboard into a Txx variable. Then send the T values to the log just like the others you are sending.
  8. 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
  9. 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.
  10. 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.
  11. "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!
  12. 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....
  13. 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.
  14. 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.
  15. 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?
  16. 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.
  17. 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.
  18. 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
  19. 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.
  20. 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...