Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Activating and Halting a Script On an Interval

Featured Replies

Hi gang,

I wanted to see if there are any handy tricks out there to solve a problem I am having.

I have a file called "FileA" which has an important script that runs every 10 seconds to update an activity list.

I want the script to HALT if the active file IS NOT "FileA" and then RE-ACTIVATE when the script has been halted and file "FileA" has been re-activated.

I realize I can script the HALT/ACTIVATE this interval script via navigation button, but my problem is the users have multiple windows up at a time and just click windows when needed.

What would be nice is that scripts would run independent in their own file (in the background) so that if I was working or running another script in another file, all would be well. For example, if I click and activate a file called "FileB" and turned on script debugger, the interval script from FileA would not trigger until I re-activate FileA.

I'm gonna keep trying to figure this out, but if someone has the answer from past experiences, please do share.

Thanks all.

When you say "is not active" do you mean is not the active window?

  • Author

Rick - not the active FILE ;-)

Files are only active through their windows.... so it's not clear what you mean by the disctinction.  Do you mean - as Rick asked - if the frontmost window at the time is not from FileA?

This kind of thing is what server-side schedules are for.  That way it affects no users' session and you don't have to worry about the intricacies of the OnTimer event.

  • Author

Actually, Wim, this is why I am asking. Sorry if my post is confusing.

In File A (in one window), I have started an OnTimer Event.

If I move from that file and I start working in another file (in another window), if I launch my script debugger, the OnTimer script runs from File A runs even though I am in a different FILE. Annoying.

Just wondering if there is a way to disable that script when the File A is not the file I am working in without having to run a script to stop the OnTimer Event.

Thanks!

Nope, the whole point of an OnTimer is that it is attached to a window and remains there until you close the window or remove the OnTimer.

I wonder if you could add some logic to the OnTimer script to exit if it's not the front window.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.