Jump to content
Macro Express Forums

Run macro every ''X" occurances?


wtawta
 Share

Recommended Posts

Can't seem to wrap my head around making this work the way I want. Simple for some of you so I hope you can help?

 

I want to run a macro every "X" occurances of an event. Let me try to explain in more detail and as simply as I can. Every "5" times a "Notepad" window is opened I want to run my macro. I would like to be able to change the number from 5 to whatever number I want of course.

 

So I'm thinking that every time Notepad is opened, one macro is counting each event and logging it in a variable and everytime that veriable equals my number, in this case "5", another macro is triggered??? If I'm on the right track so far then I realize that my triggered macro will need to reset that veriable from 5 back to zero somehow in order to repeat the after another 5 instances.

 

Hope this makes sense and you can help me out.

Link to comment
Share on other sites

Well, you need only one macro. Each time the macro runs (whenever the Notepad window opens), it retrieves the previous value of the counter, increments it and stores it external to Macro Express (either in a file or in the registry). When the counter is divisble by 5, run the rest of the macro, otherwise return immediately.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...