InTouch, wait during script execution

Join Date
Dec 2016
Location
Battle Ground, WA
Posts
19
Fairly new to using this software. Working on making some changes with a trend client for better UI. I'm currently working on a setup where I have 2 condition scripts. Sometimes the operators only need to execute the first one (we'll call it CON_A). Sometimes they need to execute the second one (we'll call it CON_B). Originally, the process would be that 1 button would execute CON_A, then a second button would execute CON_B. I'm trying to consolidate this to 1 button. The problem is that CON_B is dependent on the execution of CON_A, even though CON_B is the same code as CON_A with a couple extra lines at the end. Problem is, I can't just eliminate CON_A because then CON_B doesn't work. Easy solution is to just make CON_A true in the first line of CON_B script, but part of the functionality isn't working, which leads me to believe that CON_A doesn't complete in its entirety. I can get the function to work, as long as I execute CON_B twice, or CON_A seperate followed by CON_B.

I'm hoping that someone knows of some sort of "wait()" function, if it even exists, where I can halt CON_B for maybe 10-30ms in the second line (right after calling CON_A) so that CON_A can finish executing.

Both only contain code for "On True", do some work with recipes, and both set themselves to 0 at the end. Hopefully that's enough info for people to help me. TIA
 
Create a Memory Discrete tag called "CON_A_Done" and set it at the end of the CON_A script, then trigger the CON_B script when the CON_A_Done tag is true.

Reset the CON_A_Done tag at the end of the CON_B script.
 
You just gave me an idea. I can just change my button so that it executes CON_A instead of CON_B, and put the call to CON_B at the end of CON_A. I think that will resolve my problem. I will update soon if I can finish it in the next 10 minutes, otherwise I will update Monday. You method wouldn't work as written because the button I press calls CON_B, but I can make it work a different way, since the intent is to eliminate the button for CON_A entirely.
 
Still doesn't work. I have to press the button twice for it to work. But I may have a different issue... I tried reverting back to the original, and found that it doesn't matter if I run CON_A separate from CON_B, I still have to run CON_B 2x in order for the changes to be effective in the window.

For context, the final 3 lines of CON_B are (basically)
Hide the window
Show the window
CON_B=0

I have to leave now, so I'm gonna pick up again on Monday. Maybe a good night's sleep and some D&D will help me figure it out.

If it matters, using Archestra to create the graphics, and there are some scripts in Archestra for when the window opens and while the window is open that are basically to make the trend pens show up and populate a table below the graph (another headache I want to fix is that when I first open the window I can't get the trend pens to load, even though the code looks to me like they SHOULD be loading.

Basically, this one window ends up doing a lot of handshakes back and forth between a trend client, Archestra, InTouch, and the PLC
 
Here you go...I assume you want CON_B to only be on when CON_A is on.
-----------------------------------------------------------------------------------
Make new "Memory Integer" tag:

CON_Count
Initiial Value: "0"
Min Value: "0"
Max Value: "100"
------------------------------------------------------------------------------------
Make this Condition Script using these 2 scripts:

Condition: Con_A

Condition Type :["On True"
Script:
CON_Count = 0
{Now insert the rest of you script you want to run on "CON_A"]}

Condition Type :["While True" Every "1000" msec]
Script:
CON_Count = CON_Count +1

------------------------------------------------------------------------------------
Now when "CON_A" is on, "CON_Count" is incremented every 1 sec from "0" when CON_A is on and is reset to 0 when CON_A is off.
======
Now let's deal with turning on "CON_B"...
-------------------------------------------------------------------------------------
Make this Data Change Script (which will energize "CON_B" 3 secs after "Con_A"), but you can adjust to what you want up 10 secs or longer if you change last command shown at bottom of script :

Condition: Con_Count

Script:
IF Con_A == 1 AND CON_Count => 3 THEN
Con_B = 1
ENDIF

IF Con_B = 1 THEN
{Now insert the rest of the script you want to run on "CON_B" just do not forget ENDIF after your script]}


{Insert this script below after your script for CON_B This part of script is to keep "CON_Count" from exceeding Max Value. here I used reset to 10, just make sure you do not reset below CON_B on count.}

IF CON_Count == 100 THEN
Con_Count = 10
ENDIF
 
Last edited:
Sorry for delayed reply, have been busy with 2 startups that last two weekends with 1 day off between for new year's day.

I did get this resolved. I found part of the problem was in the script for the "While shown" portion of the Archestra graphics. Once I resolved that and incorporated the timer you suggested, it resolved all of my issues.

Thanks for the assist.
 

Similar Topics

Hi all. Customer wants analog faceplates really bad, even if we explained that it doesn't make much sense in his process. What he wants to see...
Replies
5
Views
80
Trying to export a Modern application for an upgrade to Intouch 2020 but I cannot export the application from the 2014 version because the export...
Replies
2
Views
103
Hi guys, I have experience with PLC to Excel etc...just starting on using intouch scada screens. I have an Excel sheet that uses mainly...
Replies
1
Views
134
Currently we have a fat( I think that is what it is called) Intouch application. An application resolution of 3840x1080, and inside that 2x...
Replies
0
Views
87
Hi guys We're in the process of creating a ME runtime to operate on a PC running windows using a InTouch INDT156 touchscreen, and we're having an...
Replies
3
Views
138
Back
Top Bottom