Support Forums
Popup Page Timeout Limit

Is there a way to set a popup page to automatically close after it has been open for too long (say 30 seconds?)

Is there a way to set a popup page to automatically close after it has been open for too long (say 30 seconds?)

You could add some custom page code. Here is an example that sets up a counts (you can draw as a text expression just put putting the variable name in the expression)

Here is the custom code for a three-second countdown and auto page close.

[
  Title = "DB7otzy1/";
  WinFlag = 1;
  countdown = 3; {New Var for Counter} <--Add This
]

Main [
  {Countdown Then Close} <--Add From Here
  If Timeout(countdown > 0, 1); 
  [
    countdown -= 1;
    ifThen(countdown == 0, countdown="Bye",\DisplayManager\StopPage(Self););
  ]
  {end--Countdown Then Close} <-- To Here
You could add some custom page code. Here is an example that sets up a counts (you can draw as a text expression just put putting the variable name in the expression) Here is the custom code for a three-second countdown and auto page close. ```` [ Title = &quot;DB7otzy1/&quot;; WinFlag = 1; countdown = 3; {New Var for Counter} &lt;--Add This ] Main [ {Countdown Then Close} &lt;--Add From Here If Timeout(countdown &gt; 0, 1); [ countdown -= 1; ifThen(countdown == 0, countdown=&quot;Bye&quot;,\DisplayManager\StopPage(Self);); ] {end--Countdown Then Close} &lt;-- To Here ````

Trihedral Engineering Ltd.

So just confirming, i put this code into the pages '.SRC' file, then import these changes, then it should work?

I added a text box with a text expression of "[countdown]" but it seems this counddown isnt actually happening as the page never closes?

So just confirming, i put this code into the pages &#039;.SRC&#039; file, then import these changes, then it should work? I added a text box with a text expression of &quot;[countdown]&quot; but it seems this counddown isnt actually happening as the page never closes?

You would add this to the pageName.src file and then you need to click the two arrows in a circle symbol on the VTScada Application Manager (Beside the start button for your application) to import the changes into the application.

Also, note that countdown is a page variable, not a tag value, so you would just put \countdown in the text box expression.

You would add this to the pageName.src file and then you need to click the two arrows in a circle symbol on the VTScada Application Manager (Beside the start button for your application) to import the changes into the application. Also, note that countdown is a page variable, not a tag value, so you would just put \countdown in the text box expression.

Trihedral Engineering Ltd.

edited Oct 21 '22 at 4:53 pm

I put the code exactly as you showed (without the notes of what needs to be added where and imported it successfully and it doesnt seem to show the value in the text box or close the window.

I am mildly confused about your if statement though, when countdown==0 if true it sets the counter to a string, then if false it stops the page?

I dont quite understand the documentation on the site for this ifThen as it doesnt denote which expression is the true and which is the false, it just calls them Expression1 and Expression2 and default

I put the code exactly as you showed (without the notes of what needs to be added where and imported it successfully and it doesnt seem to show the value in the text box or close the window. I am mildly confused about your if statement though, when countdown==0 if true it sets the counter to a string, then if false it stops the page? I dont quite understand the documentation on the site for this ifThen as it doesnt denote which expression is the true and which is the false, it just calls them Expression1 and Expression2 and default

Thanks for the update. I think the issue with your interpretation of the ifThen() is that you are reading it as if it were an ifElse().

ifThen() should be read as, if the first parameter is true, execute each of the additional parameters.
ie: ifThen(if true, do this, and this, and this ... and this)

Can you confirm you have the code on your popup page which you wish to automatically close?

Click the gif below to play it.

6352ce79064b8

Thanks for the update. I think the issue with your interpretation of the ifThen() is that you are reading it as if it were an ifElse(). ifThen() should be read as, if the first parameter is true, execute each of the additional parameters. ie: ifThen(if true, do this, and this, and this ... and this) Can you confirm you have the code on your popup page which you wish to automatically close? Click the gif below to play it. ![6352ce79064b8](serve/attachment&amp;path=6352ce79064b8)

Trihedral Engineering Ltd.

edited Oct 21 '22 at 5:55 pm

Ah, thanks for the explanation for the ifThen.
I found the error, i had two sets of SRC files and i though the one i was editing was the correct one as it matched the name of the page in the editor. I have been trying to delete the copy of the page file but it denies my delete every time.

Sorry for the confusion, your code works perfectly as intended.

Ah, thanks for the explanation for the ifThen. I found the error, i had two sets of SRC files and i though the one i was editing was the correct one as it matched the name of the page in the editor. I have been trying to delete the copy of the page file but it denies my delete every time. Sorry for the confusion, your code works perfectly as intended.

Wonderful. I'm glad that you figured it out. Nice Work!

Wonderful. I&#039;m glad that you figured it out. Nice Work!

Trihedral Engineering Ltd.

67
7
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft