Here is update, manage to solve problem of oilpump to work automatically , by myself (that is important, just kidding).
Here is in video what I did
https://youtu.be/G*********qxjDDw?t=2s
So to recapitulate what all I tried before I came to this solution.
First I made macro that controls oil pump and it is activated/triggered over button that I add in mach3 screen by program machscreen editor (it is free), and in my case I connected input that counts impulses on input Index and pressure switch from oil pump (that serves for detection is there any oil and is pump in working condition ) on Timing input, as I use CSMIO/IP-S as I concluded I can treat those inputs(Index and Timing ) as regular inputs (Input 1 to 4) and I used them because I I thought I have only those 4 inputs.
So macro for for controlling oil pump works correct when is executed over button (I named it Auto lube) and everything work OK until E-stop is activated , I made macro for oil pump to save how many impulses is counted in file named oilpump.txt so I can have exact number of counted impulses even if I close Mach3 and open it again (for that I need to delete from code part that initializes counter of impulses on zero every time I press Auto Lube button).
So next I thought that problem that I have by stopping macro by Estop can be easily solved by inserting code in macropump (like Hood said it is macro but it executes cyclic after you turn on mach3, you do not need to press any buttons or switches , you just need to adjust in general config that you want to use it, just check box where it say macropump and that is it, escape mach3 and come back and it should work, and inside of macropump you can put what ever you want that need checks to be executed cyclic (from my experience, I put inside logic that checks do I want to open or close power chuck, and now will need to put same logic for tailstock, and most important thing that I discovered you need to put inside of macropump SetOEMTrigger(*********) function).
So as I wanted to cyclic run code that will count impulses in order to control oil pump I put code inside of macropump, and I thought, OK it will work same as in macro triggered by button (Auto lube), but it does not work , why, probably because of code that is necessary for macro for counting impulses, it needs to detect is it rising edge present (otherwise if sensor is active , macro will count presence of sensor same as timing pulley made one revolution which is not good , because of that it needs to count changes not presence , and other thing is that data is saved in file (and file needs to be open and closed), anyway probably that goes from some reason slow in macropump and because of that it misses to count impulses (it counts but not accurate).
And only solution till now that I can use is to use code over macro triggered by Auto lube button, but in that way macro counts correct but it is stopped when Estop is activated, I have nothing against stopping because I will not get wrong data but I need to manually press activate pump and I can easily forget to press button, so after reading forums I discovered that there exist brains in mach3, only problem I never used them and have no clue what that should be, it sounds complicated "brain" haha. It is similar to ladder diagram for programing PLC, so you can activate output by input and you can between insert some logic and as I read they are faster then macros.
So I had simple idea, when Estop is acknowledged (I need to press RESET) if I want to start macro for oilpump (I named it m555.m1s) , so if Estop is triggered I must press RESET if I want to continue to work, I can not forget to press it.
And after experimenting with bits that I tested before (some OEM cods) I gradually came to solution to choose brain and make some logic, I guess.
So when Estop (LED with code 800) is not turned on , it needs to activate OEMTrigger1 which triggers macro (m555.m1s), Estop and OEMTrigger1 are connected over (no operation inverted), and as I described in macropump needs to be SetOEMTrigger(555) .
How that works, macropump is cyclic running and inside of it is SetOEMTrigger(555) and it waits for OEMTrigger1 to be activated (in System HotKeys Setup under Triggerer#1 is selected code 301, and that means when OEM Trigger#1 input is activated it will trigger my macro m555.m1s , and that will happen when I press on button RESET (for that need to be no operation inverted).
Hope you can follow idea and what I did, in that way I do not need to worry about oil pump at all because it will automatically be under control of macro555 (it is script because I do not made button for it, script/macro all the same to me) and information about how many impulses is counted is in file oilpump.txt, I just need to worry is there enough oil in reservoir
I do not know why link for video is wrongly showed *******, I did not wrote those symbols
If you are interested in video try to copy paste this in youtube search :
Macropump Macro Mach3 Brain OEMTrigger