Jump to content
Macro Express Forums

jack777

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by jack777

  1. 44 minutes ago, rberq said:

    Didn't you already ask the first question in another thread?  I believe the answer was, the scheduled macro will not run again if the previous instance is still running.  I would recommend you do some testing to make sure that is true.   

    For your related question, this should work:

    1) When your macro starts, create a temp file -- let's call it marker.txt.

    2) Start the batch script.

    3) Use a Repeat loop to check over and over for the existence of marker.txt.  Do not exit from the Repeat loop as long as the file exists.  Somewhere inside the Repeat loop, include a few seconds delay -- this is just so looping won't chew up so much processor time.
     
    4) As the last step in your batch script, delete marker.txt.

    5) Next time the macro goes through the Repeat loop, the file will no longer exist, so exit from the Repeat and the macro can continue with whatever else it needs to do.  

    Yes I already asked a similar question... Sorry. But I checked with examples. And I noticed the macro runs again every minute even if the previous instance didn't terminate... I will try your solution...

  2. 4 hours ago, rberq said:

    Take a look at Cory's suggestion, though -- his is simpler to program.  Execute the macro only once, so it does its thing then idles for the random time before doing its principle function again, generating a new random interval, and so on.  You don't even have to intervene to start it running, just schedule it to run when Macro Express is started.  

    My thinking is kind of stuck at the Macro Express 3 level which doesn't allow for more than one macro to run at a time -- therefore I missed the option of having your macro run only once for a duration of many hours or even days.  With ME3 if the macro runs continuously, then no other macros can run.  With ME Pro a long-running macro doesn't block other macros from running. 

    I'm running Macro Express pro so more macros is not a problem for me. But I don't understand Cory's suggestion. Maybe because my English is limited...

  3. 5 hours ago, rberq said:

    Schedule your macro (with Macro Express) to run every 1 minute.  Durin each run of the macro:

    If "timer file" does not exist, generate a random number between 60 and 120 (because you want between 1 and 2 hours).  Store the number in a text file ("timer file").

    If "timer file" DOES exist, read it, decrement the number by 1, and check whether the number has reached zero.  If not, store the new (decremented) number in "timer file" and exit from the macro without doing anything else.  If time HAS reached zero, delete "timer file" and do whatever other stuff the macro is intended for.  Because you have deleted "timer file", next time the macro runs 1 minute later the whole scheduling process will begin again.

    If you have Macro Express run your macro every 5 minutes, instead of every 1 minutes, then the decrement described above would be 5, not 1.  And so on -- since you have a fairly broad time range for your random runs, it is not really necessary to check "timer file" as often as every minute.   

    Somebody will probably embarrass me with a much simpler method, but that's all I have come up with for now. :huh:

    Looks like a pretty nice solution ! Thank you very very much !!!!

×
×
  • Create New...