Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,201
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. I don't mean to disparage Namino's idea, it may be great in a private environment that you control. But if you are writing production macros for use on many PCs, the ram-disk software is one more non-standard thing to install and maintain on all those PCs.... If it's not vanilla, somebody's going to be allergic to it.
  2. I don't know how big your macro is, but I DO know what you mean by "there are a LOT of delay entries I'd have to edit" -- I have done it and it's an awful job. That's why I never bother any longer capturing keystrokes -- too much problem with the timing, and you get halfway through and make a mistake and then you have to start over or remember where the mistake was and go back and fix it anyway with the editor. I just use the scripting error right from the beginning and build the macro that way. Write a few lines, test it up to that point, write a few more, test, and so on. I have yet to find a macro that runs too fast overall, though you may find a few spots like clipboard commands or window changes where you need to add delays or "wait for window", or you may set keystroke speed a little slower in a few spots where you want the user to actually watch what is happening. Setting a slow keystroke speed is also very handy while debugging so you can watch where it goes wrong, then comment out the "keystroke" command once you fix the problem.
  3. If you capture a macro directly from your keystrokes, there can be a lot of delays built in because ME will capture all your hesitations and play it back the same way. Look at the macro with the script editor and you can see the delays and delete them. Then, if anything, it might play back too fast. I think there's an option to keep ME from capturing the delays, but I don't have a PC handy with ME installed so I can't look it up now. There are probably good uses for adjusting macro playback speed but I have never found the need to do so.
  4. Good thinking, Johnboy. I need to do something like that with an application that runs on servers 400 miles away and has unpredictable timing like you describe. The trouble is, it's a Citrix application so it's hard to find text to check because of the way Citrix paints the screen. Have you tried "Wait for Window Title to Appear"? The other unpredictable timing seems to involve drop-down lists, where it might be very fast (or not!) for the list to open. I'm still not sure what happens, but sometimes the macro seems to make its selection before the list is ready to accept it. Any suggestions are welcome!
  5. And if you follow Kevin's suggestion, put comments in the VB program and in the macro until your fingers get tired, because to the next programmer who works with the code it ain't gonna be obvious what you are doing.
  6. Hand it off by writing it to a dedicated file -- slow and still not elegant, but avoids the problem of other operations using the clipboard. Hand it off via a Windows Registry entry. A bit more elegant. I have tried doing it with a Windows Environment Variable, but couldn't get it to work because the VB application apparently doesn't see the same "environment" that ME sees. You would think Bill Gates would have given us a Windows Global Environment Variable before he ran off to save the world.
  7. Very clever, Cory. Much better than looping through one character at a time as I was going to suggest. Here is a slight elaboration on Cory's method, which will strip off the possible second name. It relies on there being at least one space immediately before the ampersand. If your names are in a text file, you can wrap the whole thing in "Text File Begin Process" and "Text File End Process" to bring the lines one at a time into the T1 variable. <TVAR2:01:01:Parker, Fred & Parker, Joan><TMVAR2:07:01:00:000:000: ><IVAR2:01:13:1:,><TMVAR2:10:02:01:001:N01:><TMVAR2:21:02:00:000:000:,><TMVAR2:11:01:00:001:N01:><TMVAR2:02:01:00:000:000:><IVAR2:01:13:1: ><TMVAR2:10:03:01:001:N01:><TMVAR2:21:02:00:000:000: ><TBOX4:T:1:CenterCenter000278000200:000:ResultsFirst name: "%T3%" Last name: "%T2%">
  8. Kevin, is the clipboard delay intended to help when copying to the clipboard, when typing/storing data that is already in the clipboard, or both? See my posting above where I could not get the clipboard commands to fail at all. Here's my testing macro: copies text to clipboard, instantly pastes it (which always succeeds), and appends any non-null values to a variable (which also always succeeds). Clipboard delay is set to zero. 10 ms delay within the loop has been commented out. I fully expected to see problems when running the macro, but I did not, and I don't know why not. Unless there is something totally dumb in my logic, in which case I will be very embarrassed. <REM2:clear clipboard and working variables to nulls><TVAR2:01:01:><TVAR2:02:01:><TVAR2:03:01:><TMVAR2:16:01:00:000:000:><REM2:when macro is started, cursor should be on a long line of text><REM2:highlight the whole text line so it can be copied to clipboard><TEXTTYPE:<HOME><SHIFTD><END><SHIFTU>><REM2:loop, storing clipboard each time through the loop if it is non-null><CLIPC><TEXTTYPE:<END><ENTER><CTRLD>v<CTRLU>><REP3:01:000001:000001:00300:1:01:><DIS:<IMSD:10><IFOTH2:07:1:><ELSE><TVAR2:02:03:><TMVAR2:07:03:00:000:000:%N1%><TMVAR2:08:03:02:000:000:><TMVAR2:07:03:00:000:000: ><ENDIF><ENDREP><TMVAR2:07:03:00:000:000:**** END ****><TBOX4:T:4:000010000016000998000716:000:Values of T3 Variable%T3%>
  9. hpram99 said, "... the clipboard will not be available until it's finished with it's initial task of being filled... so really it is all or nothing." Agreed. I did some testing: Initialize clipboard to nulls. Highlight a long line in a .txt file. Copy to clipboard. Repeat 300 times. If clipboard = null Tell me it is null Else Append clipboard content to T1 variable End if Repeat End Text Box Display of T1 variable With no delay in the loop, each time through the loop checking whether the clipboard was still at its [initial] null value, or had data in it, I never got a partial result in the clipboard; like you say it was all or nothing. In fact, I never got a "null" in the clipboard at all -- even with the clipboard delay set to zero, even with the CPU at 75% zipping a large file, the first time through my loop always had all expected data in the clipboard. In other words, I could not get the Clipboard Copy command to fail at all. This was on two different PCs both running Windows XP Service Pack 2. And yet I have had to add as much as a 500 millisec delay in some production macros, after the Clipboard Copy, to get them to work (mostly) reliably. Inconsistent behavior is the antithesis of how computer software should work. This is why I have jar on my desk, taking contributions to the "Send Bill Gates to Jail" Fund.
  10. If you turn off ME and do all keystrokes manually, can you reproduce the 'dunk' ?
  11. In Windows Control Panel, Sounds and Audio Devices, there is a Sounds tab where you can tailor the sound (the .wav file) that Windows uses for a variety of Windows events. One of the options for each event is "None". If you can figure out which "event" is associated with a menu selection, you can turn off that particular sound.
  12. paul, would you be willing to publish your clipboard macros here, so we don't have to re-invent the wheel?
  13. If your problem is primarily getting fields copied reliably into the clipboard, see a recent topic "Old chestnut - unreliable clipboard copying". Paul suggests, in that topic, setting the clipboard to nulls before doing the copy-to-clipboard, so he can then check (in a repeat loop) for a non-null value to determine whether the copy has completed. He has written a callable macro for that purpose. Because the repeat loop runs only long enough for the clipboard operation to finish, it should in theory adjust automatically for faster vs. slower PCs. I will reply to that topic and see if Paul will publish his clipboard macros for us to try, since I am seeing the same problem you are, though with Citrix screens rather than browser screens. I wonder, for one thing, how he distinguishes between a truly null field that he tries to copy-to-clipboard, as opposed to a copy request that has not completed? Also I wonder whether the copy-to-clipboard is an all-or-nothing operation, or one that may be partially complete. That is -- if I do the clipboard copy command on a 20-character field, wait 10 millisecs, then check the clipboard contents for non-null, then wait another 10 millisecs and check contents again -- is it possible that the first wait will give me perhaps 7 out of the 20 characters, the second wait will add a few more characters, and so on?
  14. First, check Options | Preferences | Scheduler | Timer Interval. Make sure you have the interval very small, 1 second for the highest precision. Probably 5 seconds would be OK if you don't mind 10 seconds or so of slop in your start times. Second, from your sample times, it looks like there is a cumulative time slippage of a second or two with each execution, which will make the macro later and later as the hours and days go by. I have not tried this, but perhaps you could use the "hourly" schedule method rather than the "other". Presumably that would start the macro based on the clock time, rather than relative to the previous execution time, so there should be no cumulative error. Since you want it to run on the half hour as well as the hour, duplicate the entire macro under another name and schedule the first to run at 0 minutes past the hour and the second one to run at 30 minutes past. Or (probably better) schedule two small macros that way, which each do nothing but call ("Macro Run") your "real" macro; that way you don't have to maintain two copies of the full macro.
  15. Under Windows/Programs there are several "Set Integer to..." commands that give you screen width and height in pixels, which I think are the resolution numbers you are looking for.
  16. Try this. Lots of delays built in so it's easier to watch it run. It's my suggestion from above, to pick up the file name after the user has saved the file. But it's done with keystrokes rather than with the mouse. // Here: T1 contains information to be saved to the file Variable Set String %T1% "File Content Here" // Launch Notepad, type value into empty file, issue ALT - File - Save As s Program Launch: "notepad.exe" Text Type: %T1% Wait Time Elapse: 0 Minutes 2 Seconds Text Type: <ALTD>f<ALTU>a Wait Time Elapse: 0 Minutes 2 Seconds // Message box to user telling him to save file -- serves double duty by pa Text Box Display: Save the file // User will save the file, then macro regains control here. Activate Window: "Notepad" Wait For Window Title: "Notepad" // Issue the ALT - File - Save As sequence, pick up the path just used for // then ESC escape from Save As dialog. Text Type: <ALTD>f<ALTU>a Wait Time Elapse: 0 Minutes 2 Seconds Keystroke Speed: 500 Milliseconds Text Type: <ALTD><ARROW DOWN><ALTU><ARROW DOWN><ENTER> Keystroke Speed: 0 Milliseconds Clipboard Copy Wait Time Elapse: 0 Minutes 2 Seconds Text Type: <ESC> Wait Time Elapse: 0 Minutes 2 Seconds // File path and name is now in the clipboard. Move it to a variable for w Variable Set String %T22% from Clipboard // Text box display of file path, for debugging purposes. Text Box Display: Debugging display // ALT - F4 to shut down Notepad Wait Time Elapse: 0 Minutes 2 Seconds Activate Window: "Notepad" Wait For Window Title: "Notepad" Text Type: <ALTD><F4><ALTU> <REM2:Here: T1 contains information to be saved to the file><TVAR2:01:01:File Content Here><REM2:Launch Notepad, type value into empty file, issue ALT - File - Save As sequence><LAUNCHDEL2:0:01C:\WINDOWS\system32\notepad.exe><TEXTTYPE:%T1%><WAITTIME:00000002><TEXTTYPE:<ALTD>f<ALTU>a><WAITTIME:00000002><REM2:Message box to user telling him to save file -- serves double duty by pausing the macro><TBOX4:T:4:000516000114000278000200:000:Save the filePlease select a folder and a file name for saving the file. AFTER you have saved the file, click OK to close this message box. ><REM2:User will save the file, then macro regains control here.><ACTIVATE2:Notepad><WAITWIN2:000010:000000:Notepad><REM2:Issue the ALT - File - Save As sequence, pick up the path just used for the file save,><REM2:then ESC escape from Save As dialog.><TEXTTYPE:<ALTD>f<ALTU>a><WAITTIME:00000002><SPKEY:0500><TEXTTYPE:<ALTD><ARROW DOWN><ALTU><ARROW DOWN><ENTER>><SPKEY:0000><CLIPC><WAITTIME:00000002><TEXTTYPE:<ESC>><WAITTIME:00000002><REM2:File path and name is now in the clipboard. Move it to a variable for whatever else we need it for.><TVAR2:22:03:><REM2:Text box display of file path, for debugging purposes.><TBOX4:T:1:CenterCenter000278000200:000:Debugging displayFile path saved by user is %T22%><REM2:ALT - F4 to shut down Notepad><WAITTIME:00000002><ACTIVATE2:Notepad><WAITWIN2:000010:000000:Notepad><TEXTTYPE:<ALTD><F4><ALTU>>
  17. Hmmmm. You ask a question, get an answer, then you up the ante with additional requirements. Get an answer to that, and it turns out there are further requirements. That's called Scope Creep. You are obviously destined for a management position, not technical. If your macro can get or keep control after the user does the save, then have the macro do "File | Save As" a second time. Then, if you can click the dropdown arrow at the end of the File Name box, it will open a list of recent names, and the one the user just specified will be at the top, including the complete file path. Now, click on that line and the complete file path will be brought up into the File Name box, already highlighted so you can simply copy it into the clipboard. At least that's the way my version of Notepad works. The mouse operations to do this may be tricky, as far as positioning where to click. I tried to find some keystroke sequence to use instead of the mouse clicks, but was unsuccessful. Maybe you can find a sequence that will work.
  18. Are you moving the mouse relative to the screen, or relative to the application window? I have found that window-relative works reliably for me at different resolutions, whereas screen-relative does not -- though I don't really understand why. Other than that, there is a Get Control command, followed by the Mouse Click on Control command, that might work. There's a little tutorial within the Help screens that leads you through the process using the Windows Calculator application as an example. It's laborious to set up because you have to do each icon separately in your macro, using the Get Control Utility. I am told it works well for some applications but not for others. I believe that, if Get Control works for you, you can then get the text associated with the control. That might be useful to assure that you are really pointing to the correct icon before you click on it.
  19. Open Notepad (empty file), type %T1% into the Notepad screen, then type ALTDOWN - F - ALTUP - A. That should open the "Save As" Windows panels and the user can type the filename and navigate to whatever folder he wants using screens that are (hopefully) familiar to him.
  20. "Prompt for value" option within Variable Set String
  21. Your last macro line, Clipboard Paste, won't do what you want because the clipboard does not contain the N2 value. After multiplying, you can "variable modify integer" to convert N2 into a text string. Then "variable modify string" (option 2 tab) to save the string to the clipboard then do the Clipboard Paste. Or simply Text Type %Tx% to type the string into the field. When multiplying integers, be sure the result does not exceed the maximum interger value of 2,147,483,647.
  22. Can you give a little more information? Are you trying to detect ANY number that is 12 digits, or one specific number? Can it be anywhere in the file, or is it always at the beginning of a line, etc.
  23. Thank you, Kevin. I will give that a try. There is a macro that runs when ME sees a particular application logon screen, to activate the full set of macros that the application uses. So I added code to call my caching macro again at that point. That seems to have helped, but the "wait for" option at PC boot sounds worthwhile in any case.
  24. I have a group of eight macros, each activated by the appearance of one of eight specific windows. Each macro does some processing, then either the macro or the PC user takes some action on the current window, causing the next window to open, activate another macro, and so on. Usually this works very reliably. However, the first time after PC startup it seems like the macros do not always get activated -- a window will appear but the macro will not run. I have enabled Window Activation Caching. Also I wrote an additional macro, to run at ME startup and call all the other macros, on the theory that would bring them all into ME cache and improve response. That seemed to help a little, but the whole process is still a bit flaky. Ideas, anyone?
  25. Here's a way to get a slightly-delayed audible alert. Activate a macro when the "New Item Alert" window appears. The first thing the macro will do is "wait time elapse" for 30 seconds or 60 seconds of whatever. Then "If Window New Item Alert is running" sound the audible beep alarm. Presumably if you are at the computer you will close the New Item Alert window before the 30 seconds has elapsed, so the macro will just end without beeping. The only drawback I can see is that the macro will stay running for the full 30 seconds no matter what, and if you ARE at the computer you might want other macros to be able to run. You can take care of that by slightly elaborating on the above method. Fire off the macro when the New Item window appears. Set up a repeat loop for 30 or 60 or whatever iterations you want, with a one-second "wait time elapse" inside the loop. Each time through the loop, check whether the New Item window is (still) running, and Macro Stop if it is not. If you get through all iterations of the loop and the New Item window is still running, then sound the beep alarm.
×
×
  • Create New...