87squirrels Posted November 28, 2010 Share Posted November 28, 2010 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 Link to comment
LeeG Posted November 28, 2010 Share Posted November 28, 2010 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. Link to comment
87squirrels Posted November 28, 2010 Author Share Posted November 28, 2010 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? Link to comment
LeeG Posted November 28, 2010 Share Posted November 28, 2010 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 Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.