Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,203
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. Alan, is that a ME Pro feature? I can't find that activation option in ME3.

     

    rks -- I can see one way to do what you want, but it is kind of clumsy: Schedule a macro to run every x seconds, and if the window is running set a switch to "on" (probably best to store it as an environment variable). Then next time it runs, x seconds later, if it finds the switch is ON but the window is no longer running, you know it closed in the interim.

     

    Like I said, it's a little clumsy and not "instantaneous" like activating a macro when a window becomes on-top. But in the x-second intervals between scheduled runs, all kinds of other macros can run.

  2. I'm not sure what you mean by "trigger". Is the window title what triggers (activates) the macro? If so then what do you mean by "trigger a folder to be on top"? Isn't the window becoming "on top" what activates the macro, in which case it is already on top? Or are you saying that some other window can become topmost after your macro begins running?

     

    Personally I never had much luck with setting window order. A simple Activate Window always worked fine to put it on top.

  3. The logic looks OK, but your second block of code has a discrepancy between color 215 and color 255. Which color are you really looking for? Could that be the problem?

     

    Repeat Until %N2% = 215

    Get Pixel: Window Coords: 783, 651 into %N2%

    If Variable %N2% = 255

    Mouse Left Button Click

    End If

    Repeat End

     

    Even after you fix that, it is possible that Windows will treat the two distinct mouse clicks as a double-click. 100ms delay might not be enough. Other than a longer delay, another way to avoid the double-click interpretation is to move the mouse to a second location for the second click. I know you want to click in the "same" place, but maybe moving it a few pixels one way or another will still qualify as the same. For example, if I manually position the mouse over a file name in Windows explorer, and run the following macro, it acts as a double-click and opens the file. However, if I have the macro move the mouse 10 pixels to the right prior to the second click, the two clicks are treated as two clicks and the file does not open, and the delay can be removed from the macro.

    Mouse Left Button Click

    Delay 100ms

    Mouse Left Button Click

  4. XOR is the "exclusive OR", meaning one of the two conditions tested is true, but both conditions are not true.

    For example, the macro below will display the "False" text box. If you change one of the two Variable Set String commands, then it will display "True".

     

    Variable Set String %T1% "a"

    Variable Set String %T2% "a"

    //

    If Variable %T1% = "a"

    XOR

    If Variable %T2% = "a"

    Text Box Display: True

    Else

    Text Box Display: False

    End If

     

    Your macro as written is straight-forward and easy to understand. I don't think it can be changed to use XOR. And if you could, I don't think it would be easy to understand.

  5. As you have said, you can schedule a ME macro to do the hibernation.

     

    To awaken, use the Windows scheduled task feature. Just schedule some innocuous task like Notepad to start at the wake-up time. There is a check box within the scheduler (I had to search for it) that indicates "Wake the computer to run this task". I am told this will wake it from hibernation. Haven't tried it myself, so if you try it let us know the results.

  6. Yes, schedule it to play every x seconds, whatever interval suits your fancy. You can get to the scheduling either by right-clicking on the macro in Macro Explorer, or by going into the Scripting Editor.

     

    And yes, to make the toggle macro, the easiest way is to use the scripting editor. In Macro Explorer,

    click Macro in the menu bar,

    then Add Macro,

    then choose the hot key,

    then click the Scripting Editor button (upper right).

     

    You will find in the long run that the scripting editor is the best way to do almost all development. It has been years since I made even a rudimentary macro by recording keystrokes.

  7. It is probably easiest to do this with two macros rather than one, like so:

     

    Macro A will simply type the command ONCE and then exit. On the Properties tab for the macro schedule it to "Play Macro Indefinitely" every ten seconds. Also on the Properties tab, clear the "Active" check box to disable the macro. Even though it is scheduled to run every ten seconds, it won't run while disabled.

     

    Macro B should be initiated via the hotkey. It will toggle Macro A between the enabled / disabled state. It will be basically this:

    IF MACRO_A IS ENABLED

    DISABLE MACRO_A

    ELSE

    ENABLE MACRO_A

    END IF

     

    Use Options | Preferences | Scheduler to set the scheduler's time interval to 1 second. You don't have to set that small an interval, but larger intervals will provides less precision and Macro A won't run at exactly every 10 seconds.

  8. Remove the REPEAT and the DELAY from the macro, so it just does its stuff once each time it runs, and then exits (MACRO RETURN). Using the Properties tab of the scripting editor, set it to run once every 40 seconds.

     

    Change the second macro -- the one that currently sets the run/don't run variable -- to enable/disable the first macro (MACRO ENABLE or MACRO DISABLE). The variable used now will not be needed at all. During any period when the first macro is enabled, it will be run once every 40 seconds by the scheduler. During the 40-second intervals between runs, other macros will be free to run.

     

    P.S. Use Options | Preferences | Scheduler from the ME menu bar, to set the Timer Interval to 1 second -- or higher if you aren't too concerned about the 40-second interval being quite so precise.

  9. With "Text Type - Send Directly to Control", it sounds like it is sending the text just as if you first positioned the cursor at the beginning of the field, then did a standard Text Type command. Try appending a bunch of <DELETE> characters to the end of the text before you send it to the control, and see what happens. With luck it will insert your text ahead of what is already there, then delete the original text.

     

    Edit: I tested with the Windows Calculator. With "Text Type - Send Directly to Control", and my new data in T1, it works well sending

    <HOME><DELETE> .... <DELETE>%T1%

    to the control.

  10. <REM2:text into clipboard><SPKEY:0030><TEXTTYPE:<CTRLD>a<CTRLU>><WAITPB><TEXTTYPE:<CTRLD>c<CTRLU>><WAITPB><IMSD:300><TEXTTYPE:<HOME>><WAITPB><REM2:clipboard into T1><TVAR2:01:03:><REM2:clear destination><TVAR2:02:01:><REM2:parse><REP3:08:000002:000001:0099:1:01:T99><IVAR2:01:13:1:status><IFVAR2:2:01:1:0><EXITREP><ENDIF><TMVAR2:11:01:00:001:N01:><TMVAR2:11:01:00:001:006:><IVAR2:02:13:1: ><TMVAR2:10:03:01:001:N02:><TMVAR2:08:02:03:000:000:><ENDREP><REM2:display parsed data><TBOX4:T:4:CenterCenter000278000200:000:T2 value parsed%T2%><REM2: ><REM2: >

  11. Yes, that would be easier if it is always 8 digits, but some of your examples were not 8.

    Here's something you could try: Once your number is at the beginning of the text string, try

    Variable Modify String Convert to Integer. It's really sloppy programming, but as I recall Macro Express will take the string of characters, until it finds a non-numeric, and convert it. Then

    Variable Modify Integer Convert to Text String to get it back to text.

  12. You're doing pretty well. But:

    Image 4 -- starting position should be Value 1, rather than N1.

    Image 5 -- starting position should be Value 1.

    Image 6 -- Looks good. Since you are searching for a single blank, you have to actually type a single blank into the Search Text -- since it is blank, I can't tell from the image whether it is there or not.

    Image 7 -- This is a tricky one, and I led you astray a little bit. You will need two instructions --

    Variable Modify String copy part of T1 to T5, then

    Variable Modify String append T5 to the end of T2. Be careful not to get the "to" and the "from" backwards when you append.

  13. Once the data is in the clipboard, put it a variable like T1. Then:

    Variable Set String T2 = "" (empty)

    Repeat Start

    Variable Set Integer N1 to position of "status" in T1

    If N1 = 0

    Repeat Exit

    End If

    Variable Modify String Delete N1 characters from the beginning of T1

    Variable Modify String Delete 7 more characters from the beginning of T1 (to get rid of "status ")

    Variable Set Integer N2 to position of first blank space in T1

    Variable Modify String append N2 characters from the beginning of T1 to the end of T2

    Repeat End

     

    When this repeat loop finishes, the numeric strings will be stacked in T2 with one blank space between each string (and after the final string).

  14. I agree the feature Strahan wants would be very useful. I put in a feature request for it about 6 months ago, tracking number [iSS8287]. There is a macro program with exactly that feature, called Macro Scheduler, sold by MJT Net Ltd. (in Merry Olde England, I think).

     

    It's true you can do a lot with ME by checking specific pixels, especially if you KNOW what window is to be loaded. But if any one of a dozen windows might potentially be loaded, all with the same window title, you end up building color maps of all of them, storing the maps in a file, and writing complicated (and slow) logic to read back the file and check many pixels per potential window. An image-recognition feature would be a lot easier.

×
×
  • Create New...