triggertime

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
boruciak
Posts: 18
Joined: 31 Aug 2018 09:06

triggertime

Post by boruciak » 07 Mar 2019 15:54

Hi,
time = "{triggertime, dateformat, hhmmss}"; returns the value HHmmss.
I have a program and want to save my own Log. WriteToFile.
At the beginning of the entry, I do not want to enter the full command every time.
I want to replace them with the {T} variable. How to do it so that the variable used is refreshed. I tried to use the eval () command but...
Tnx

anuraag
Posts: 259
Joined: 24 Jan 2015 02:06

Re: triggertime

Post by anuraag » 09 Mar 2019 00:57

Your question is unclear to me. Is it 1 question or multiple?

If you share your cmd then i may try to help. eval() should work in that case.

elektroinside
Posts: 69
Joined: 14 Feb 2019 15:04

Re: triggertime

Post by elektroinside » 09 Mar 2019 07:42

"triggertime" will never change for the currently executed flow, as it is the time when the flow was executed.
If you want to log for yourself after each command, you could use another function (or create a flow which uses that function), which is getDate() instead of triggertime (or even triggertime will work, but of your "write to custom log" flow), which will also write a global variable's value after the time, to which you assign a text of your own (the text to log). It's messy, but..

This is an example of the logic, to log something after each command:

1. Execute command in a flow
2. Assign value: global_texttolog="Text to log"
3. Call (execute) the logger flow:
-will use its own triggertime
-will initialize the file to write
-will write one line to a file, containing the time and the value of global_texttolog
4. Your write to log flow is set to "wait for the currently executed instance to finish"

This should work fine for one flow. For multiple flows executing at the same time and trying to write the same log file, you'll have to use something else, because:
1. This example uses one global variable which will constantly be overwritten by other flows
2. You'll probably have issues writing that one log file itself from multiple places, as probably the file is locked by the flow which currently writes to it, and the instances queue of the log writer flow can grow beyond the limits of AM. You'll have to test for yourself.

Post Reply