Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. Once you have your word in a text variable, get the first character into another text variable by using Variable Modify String [Copy Part of Text]. Counting characters in word: Variable Set Integer[Get Length of a Text Variable]. For the number, first convert it to a text string using either Variable Modify Decimal or Variable Modify Integer. Then proceed as with the text variable above, to find the first character (digit) or count the digits. Note that when you convert to a string there will be no leading zeros in the string.
  2. Hmmm, I never used this before, but I just tried it. IF MESSAGE appears to return a boolean true/false value. IF MESSAGE:XXXX TEXT BOX DISPLAY: YES WAS SELECTED ELSE TEXT BOX DISPLAY: NO WAS SELECTED END IF Whatever you specify as default is the highlighted button on the display, and is also the boolean value returned on timeout. So in your case maybe this would work: IF MESSAGE:Are you still using the application? [with delay time of x minutes] [DO NOTHING, LEAVE THE APPLICATION RUNNING] ELSE CLOSE THE APPLICATION TEXT BOX DISPLAY: APPLICATION WAS ENDED BECAUSE YOU DIDN'T REPLY IN x MINUTES, YOU SLUGGARD! END IF
  3. Yes, the title bar of the window. For example, if I start Notepad, the title bar is "Untitled - Notepad". If I open file abc.txt with Notepad, the title bar is "abc.txt - Notepad".
  4. If you know the Windows title of the text box, can you perhaps use "If Window is On Top" to see if it is the active window?
  5. I think what you are doing is "safe" -- that is, variables are automatically shared among calling and called macros. Why ME doesn't just preserve them generally, I don't know. Seems like it would save a lot of trouble.
  6. It's a little extra effort, but you can save a Txx variable to an environment variable, which you can call anything you want. You can indirectly save a Dxx or Nxx variable to an environment variable by first converting it to text -- then of course you have to convert it back when you retrieve it. I have several groups of macros that must coexist on the same PC. Each group is consistent within that group as to how the variables are used; but the groups could step on each other. So I wrote separate save-variables and restore-variables macros for each group. All 99 integer variables are converted to text and stacked (space delimited) in a single text variable that is then saved in an environment variable. All 99 decimal variables are likewise converted and stored in a single environment variable. The 99 text variables must each be stored in its own individual environment variable. They can't be stacked unless you can come up with a delimiter character that will never appear as valid text. The above works well, runs surprisingly fast, and is a royal pain in the butt. When I convert to ME Pro, one of the first things to do will be assign unique names to critical variables.
  7. What do you mean by "during a session of making changes to the macros"? I have been puzzled a couple times where a window title partially matched a macro title, and using the ME script editor caused the title-activated macro to run. So if ME tried to activate a window, which one will it activate, the script editor window or the "real" application window?
  8. The macro as I posted it already saves the starting mouse position (screen relative) and puts the mouse back there when it's done. Before checking the pop-up, you can do "Variable Set String from Topmost Window Title" to store where you are coming from. Then after disposing of the pop-up you can Activate that window. But you can only check color on the topmost window, or at some point on the screen meaning the window in question has to be visible. So even if you can get it to go back to your original window, it's still going to be disruptive if you are trying to do more on the computer than just listen to music. There are some timing delays in my macro that you may be able to remove.
  9. Here's one that works with Sirius. I have it scheduled to run every 8 seconds. It checks the pixel color at the spot where the popup occurs within the Sirius window. If the color is other than "standard" it moves the mouse to that spot and clicks the mouse. The drawback with this macro is that it has to bring the Sirius window into focus every time it runs. That's OK for me because I only activate the macro when I am listening to music at home and not using the computer for anything else. It would be very disruptive if I were trying to do other work on the computer. Of course, if you are sitting right there working on the computer, you could just click on it yourself. Can you give more details of what your popup actually looks like? <REM2:If Sirius is active, save mouse position on current window, switch to Sirius window,><REM2:Check the color of the area where the "Are you still listening?" question appears, ><REM2:If it is other than its standard color, click it to reply and it should go away. ><REM2:Then switch back to original window and restore mouse to its original position><IFOTH:04:2:www.sirius.com><MOUSEPOS:T:01:02><ACTIVATE2:www.sirius.com><WAITTIME:00000001><REM2: ><IVAR2:03:01:291><IVAR2:04:01:338><GETPX:5:W:%N3%:%N4%><DIS:<LOGFILE:YY:Color retrieved from screen location %N3%,%N4% is %N5%><DIS:<TBOX4:T:4:CenterCenter000278000200:000:DebuggingColor retrieved from screen location %N3%,%N4% is N5 = %N5%><IFVAR2:2:05:2:15921906><MMW2:3N,4N><IMSD:400><LCLK><LOGFILE:YY:Color retrieved from screen location %N3%,%N4% is %N5%><LOGFILE:YY:Clicked on popup to keep Sirius alive><WAITTIME:00000001><MMS2:1N,2N><ENDIF><REM2: ><ENDIF>
  10. I think very likely you have diagnosed the problem correctly. ME only launches the .bat file and does not wait for its completion. Here's a commonly used ME trick. Select a control file name, like c:\temp\control.txt. The first thing your .bat file will do is delete that file. The last thing your .bat file will do is create that file, simply by copying a dummy file to that name. Now, your macro will 1) start the .bat job 2) delay a few seconds just to make sure the .bat job has time to delete the control file 3) run a repeat loop checking for existence of the control file -- you probably want a few seconds delay in each pass through the loop just to reduce CPU time 4) when the control file is found to exist, you know your .bat job is done, so you can do the date stuff and copy the spreadsheet
  11. scroll lock + pause is the standard sequence to abort a running macro. To abort when the mouse hovers, try this: instead of a single 10-second delay, do a repeat loop with 1000 delays of 1/100 second each. Something like this: repeat 1000 times get mouse position (x and y coordinates) if mouse position within your abort area macro stop else delay 10 ms repeat end So when you move your mouse to the "abort" area, the macro will end within about 1/100 of a second. Due to ME overhead, 1000 delays of 1/100 second each will wind up being more than 10 seconds total, but you can test it, time it on your watch, and adjust the number of repeats appropriately.
  12. I know this isn't what you asked, but: We do just what you are suggesting, except we have ME running on each user's PC. Works fine. But what you are asking is beyond my Citrix knowledge.
  13. Try the Wait for Web Page command. It is under Timing in the scripting editor.
  14. Another way to do it: Use the properties tab to schedule your macro to run once every second. Do not initiate it by clicking on an area of the screen. (Also use Options | Preferences | Scheduler to set the ME timer interval to 1 second). At the beginning of your macro, Restore Variable N1, then check the value of N1 to see if it equals 1. If it doesn't equal 1, Macro Stop. Write a second macro that IS started by clicking on an area of the screen. Each time it runs, all it does is: Restore Variable N1 If N1 = 1, set it to zero, else set it to 1. Save Variable N1 So each time you click on your screen area, you will be toggling variable N1 between zero and one. Each second, your original macro will run, and depending on the state of variable N1, it will either do its typing, or will just end without doing anything. Incidentally, 50 ms delay is 1/20 of a second. Use 500 ms if you want a half-second delay. P.S. Oops! The above may not really work right with ME 3, but should work with ME Pro. The problem is, if you click the screen during the ten second delay period, the toggle macro will probably not run -- I'm not sure without trying it. That's because ME 3 allows only one macro at a time to run.
  15. Programmable keyboards are fantastic for predictable keystroke sequences like Stan is suggesting. They are much quicker than writing a macro, for simple sequences. I can't begin to count the hours my ancient mck-142 pro keyboard has saved me for repetitive tasks. One of these days it will die. They are no longer sold. If I could buy a couple of them, I would just store them away as security. I guess there are other programmable keyboards out there, but I can't imagine one much better than what I have.
  16. I believe that ME Pro (recently released) has a GOTO command. ME 3 does not. ME 3 has a Switch / Case sequence which might help you. It requires coding your GOTO logic in-line with the Case statements; but it allows multiple Case conditions for a single block of executable code, so it's similar to but slightly simpler than coding IF A OR IF B OR IF C .... logic for A/B/C END IF IF D OR IF E OR IF F .... logic for D/E/F END IF With ME Pro you could presumably combine the Case with the GOTO.
  17. You're right, there really are two sides to the "nulls" argument, especially where there is an outright command to empty the clipboard, ME could say that storing a null variable in the clipboard was never INTENDED to work, it just by chance DID work but we shouldn't rely on it. Robin Hood -- Yes, I hadn't thought about Bill in those terms, but there's a lot of truth in the analogy!
  18. I totally disagree. A lot of $$$ go into developing software applications around something like ME. It absolutely should work the same between one release and the next. Don't accept the sloppy crack-brained Microsoft philosophy of "similar is close enough when we put out a new release, we're so big we don't have to be good". That attitude is why I keep a collection jar on my desk for the Send Bill Gates to Jail Fund. Granted, ME has a disclaimer, something like "This is OK software, but don't rely on it to control medical devices in the Intensive Care Unit, or to monitor systems in your nuclear power plant." But something as basic as that should work the same, or is should be documented as a release difference.
  19. Paul, how can you see that it is not clearing the clipboard? When I first started worrying about the clipboard, I would have ME do the CLIPBOARD EMPTY, then I would go to Microsoft Word and see that the MS Office clipboard still had 25 items stacked up and nothing had been cleared. Finally it dawned on me that Office was maintaining its own clipboard array, as opposed to the single level that Windows apparently has. Is Clipmate muddying the water like that? It also wasn't clear to me whether a time delay applied to emptying the clipboard, or storing a null variable into it. So after the CLIPBOARD EMPTY, I included a little loop: REPEAT START IF CLIPBOARD = "" REPEAT EXIT END IF REPEAT END I don't think there IS a delay for the clipboard empty or for storing a variable into the clipboard or vice versa. I guess I could put a counter into the loop to find out. As I said, the production version of my macro includes a similar loop AFTER the clipboard-copy command, delaying 20 milliseconds then checking for clipboard <> nulls, then repeat.... That loop does have a counter in it that gets written to the standard ME log just out of curiosity, so I can see how many 20 ms delays there are before the clipboard copy finally completes. Usually the count is 1, but it's not unusual to see counts of 3 or 4.
  20. I tested with Variable Set String %T1% "" Variable Modify String: Save %T1% to Clipboard instead of Clipboard Empty In a thousand repeats of the macro, it made no time difference. Maybe a different level of Windows makes the difference.
  21. Can you use the same key sequence you would use manually? ALTD-f-ALTU-c
×
×
  • Create New...