{Macrodroid Start Count}

Alan Eaton

New member
A magic integer that is incremented each time Macrodroid starts (it should be incremented before the macro enabling stage).

It might also be nice to have {Macrodroid Start Time}.
 

Alan Eaton

New member
Are you speaking about {uptime_secs} Magic text?
No. I am talking about the time at which Macrodroid starts.
You could use a global integer variable each time Device boot (or MacroDroid initialised) fires.
Both Device Boot and Macrodroid Initialised fire after the macro enabling stage. Incrementing a global variable on those triggers is too late.
 

Endercraft

Moderator (& bug finder :D)
I have "simple" steps on how you can achieve that. It involve the macro enabled trigger and the fact that a certain macro will always be enabled first.
 

Endercraft

Moderator (& bug finder :D)
  1. Go to system log.
  2. Enable detailed log level (in the filter icon).
  3. Restart MacroDroid.
  4. Find the first line saying "Enabling macro : (anything)". It should be located under "File length is : (number)".
  5. Open that macro, whatever it is.
  6. Add a macro enabled trigger to it, then with an if trigger fired condition, increment the variable.
  7. Add a cancel macro actions in the condition.
 

Endercraft

Moderator (& bug finder :D)
Which macro will always be enabled first?
I have no idea how it's determined, I just know it will always be the same. I didn't find any specific order.
If you add a macro it may reshuffle the entire list order, but I'm not sure as I didn't really investigate.
 

Alan Eaton

New member
I have already considered doing things the way you suggested.

In my system log, the first macro enabled is not the first macro I created and the last macro I created is enabled somewhere in the middle.

The order can, most definitely, change.

I would rather not depend on something that is unreliable or add actions to a macro that are not relevant to its purpose.
 

Endercraft

Moderator (& bug finder :D)
To be honest I never saw it change.
But yes it would be easier to just have a magic text incremented.
 

Dm114

Well-known member
No. I am talking about the time at which Macrodroid starts.
I use it too and get it by subtracting {uptime_secs} from {system_time}.

For the rest of your request, you're right, both triggers don't exactly fire at the exact time you're looking for. Why is it so important to you to know the exact time before launching first macros?
 

Alan Eaton

New member
I use it too and get it by subtracting {uptime_secs} from {system_time}.
That is NOT {Macrodroid Start Time}. On this device {system_time}-{uptime_secs} is a moment approximately 6 days and 7 hours ago wheras {Macrodroid Start Time} is approximately 22 hours ago. Quite a bit different.
For the rest of your request, you're right, both triggers don't exactly fire at the exact time you're looking for. Why is it so important to you to know the exact time before launching first macros?
{Macrodroid Start Count} is not a time. It is merely a count of how many times Macrodroid has started.
 

Dm114

Well-known member
That is NOT {Macrodroid Start Time}. On this device {system_time}-{uptime_secs} is a moment approximately 6 days and 7 hours ago wheras {Macrodroid Start Time} is approximately 22 hours ago. Quite a bit different.
Sorry I misread your request. What I use is the time my device booted, not MD start time.

As for your 2nd request, I was on time stuff so I forgot you are requesting a MD start counter. Why is it so important to be incremented before macros enabling and not after? Is it in case MD crashes during launching process?
 

Alan Eaton

New member
Sorry I misread your request. What I use is the time my device booted, not MD start time.

As for your 2nd request, I was on time stuff so I forgot you are requesting a MD start counter. Why is it so important to be incremented before macros enabling and not after? Is it in case MD crashes during launching process?
It is so that macros can be constrained depending on whether they have run since Macrodroid last started. If the counter is incremented after a macro is enabled then that macro may be triggered without being properly constrained (because the counter has the wrong value). Thus the counter needs to be incremented before any macro can run.
 
Top