Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

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.

Programs that affect their own starting conditions

Featured Replies

Posted

I know I've seen this posted somewhere, but now that I've run into it, can't find it...

 

I have two cases where the execution of a program changes one of the conditions required for the program to run, which causes the program to terminante prematurely.

 

The simple example is a program that I want to run if the garage door is opened and the driveway lights are not already on. Once the lights are turned on, the program terminates (and I want it to wait 10 minutes, then turn them off...). How can I decouple the program from the original conditions?

 

thanks,

-tom

One solution is to use two programs. Program 1 contains the If and runs Program 2 Then. That way when the If condition changes the reevaluation that occurs does not abort Program 2.

  • Author

If program 2 continues running after 1 ends, then I'm all set. I'll set that up and test.

 

This suggests that programs started from other programs are asynchronous, i.e., the initiating program does not wait for completion of the new program before continuing. Is that correct?

87squirrels

 

That is correct. You will find lots of good information on Program execution in the UDI Wiki. The following is an excerpt from that Wiki ....

 

Statement Execution Order

 

Within the Then or Else clause of a program, statements are executed from top to bottom in the order in which they occur. When a statement calls another program, the called program begins executing, and the calling program immediately continues execution with the next statement in sequence--it does not wait for the called program to complete before continuing.

 

Lee

Guest
This topic is now closed to further replies.

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.