Features, discussions, tips, tricks, questions, problems and feedback

Script Agent Scheduling

I’m trying to get the script to work on a tag. Unfortunately, this isn’t going as I had hoped.

Can you tell me what I’m doing wrong?

Also tried with a Timer but that did not work.

if (Adroit.GetTag(“TEST_BIT_ON_OF.value”) = True AND Timer (200) ) Then

The reason I want to use a tag is that the script should not run every time but only when a tag is on.

You need to provide more information here.

  1. Do you want to schedule a script on a periodic timer AND ONLY when a specific tag changes?
  2. What is currently happening - is it triggering erratically?
  3. Timers should not be used in scripts as the scheduling should support these use cases, so please provide more information on the current setup, scheduling and output

More information.

For this issue, I’m using a trigger from a PLC that is either true or false.

When it’s true, the script needs to run every minute.

I’ve tried to make it work with the option “Run when one of the following tags change,” but then the script runs only one time, and not all the time.

When I run the script every minute and put in the script “if ‘agent’ is ‘true’ then…”, the script works fine. However, I think that it takes a lot of resources from the server to run the script every minute. This might not be an issue with only one script, but if I use around 20 scripts like this, I think it’s not good for the server performance.

Or have I got that wrong?

You are on the right track:

You can trigger the script every minute, and do a “agent = true” check inside the script. This will not take a lot of resources, even when running 20 scripts.

An alternate option is to use an expression agent which will trigger the script, but this is a bit more complex.

So, the first option is the simplest, also from a maintenance perspective.