| Author |  | 
      
        | npavkov Groupie
 
  
 
 Joined: February 29 2004
 Location: United States
 Online Status: Offline
 Posts: 91
 | 
          I have a trigger that when I hold the dim button of a switch it produces multiple dim commands to be sent depending on how long the button is held down.
           | Posted: November 04 2005 at 23:13 | IP Logged |   |  
           | 
 |  is there a way to code a macro to only execute once (triggered) even though the trigger tries to execute the macro multiple times because of the multiple dim commands being seen?
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          I would use a Global Variable to hold a flag, normally set to "1", and used in the trigger's enable field. In your macro, set that variable to "0", handle the dim, do a Wait for some time (several seconds?), then set the variable back to "1".
           | Posted: November 04 2005 at 23:34 | IP Logged |   |  
           | 
 |  
 This should give you what you want.
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | npavkov Groupie
 
  
 
 Joined: February 29 2004
 Location: United States
 Online Status: Offline
 Posts: 91
 | 
          Tony is there a way to make a macro wait "until" a global variable changes? I want to put a macro in wait staus, then allow it to continue when a global variable changes.
           | Posted: November 05 2005 at 19:05 | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          Maybe split the macro in two around the proposed wait location, then create a trigger to run the second macro when the GV changes?
           | Posted: November 06 2005 at 09:28 | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Tony,
           | Posted: November 06 2005 at 19:23 | IP Logged |   |  
           | 
 |  
 Excellent solution for working around the multiple dim problem
   
 Concerning the macro wait until GV changes...again, I would do as Tony suggests since a waiting macro is strictly timed based.  You could have the macro wait a shorter time period and everytime it wakes up, check the GV and if not set, wait again, but I would try to split it up and have the second part of the macro triggered when the GV changes.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  |