| Author | 
         | 
         
      
        
         
         GadgetGuy Super User 
          
  
  Joined: June 01 2008 Location: United States
 Online Status: Offline Posts: 942
          | 
        
         
          
           | Posted: January 07 2009 at 21:42 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I've been fighting this all day and can't resolve it, so 
 hopefully someone can help me figure out what's going 
 on.  It seems like a bug, but I'm not sure.
 
 If I execute the 
 following:
Code: 
   
    
    
      
       ph_msgbox("Variables",ph_getglobal_s(ph_
 getglobal_s("PAR-FLG")),15)
  | 
       
       | 
    
    | 
 
 
 I get a value of "0" which is what I expect.
 
 ph_getglobal_s("PAR-FLG") returns a value of "SMS1FLAG" 
 and the double effort (indirect addressing) returns the 
 value of SMS1FLAG, which is "0".
 
 But when I use this expression as a parameter as in the 
 following simple example, it does not work. 
 
Code: 
   
    
    
      
       if(ph_getglobal_s(ph_getglobal_s("PAR-
 FLG"))=0,ph_msgbox("Var","0",15),ph_msgbox("Var","1",15)
 )
  | 
       
       | 
    
    | 
 
 
 
 Attempts to Validate the formula result in "!"
 
 I'm trying to ask if the value of SMS1FLAG=0, then 
 display a "0" otherwise a "1" but it doesn't work.
 
 If I can get this to work, then hopefully I can get the 
 real and more complex formula to work! 
 
 Any ideas?      
  __________________ Ken B - Live every day like it's your last.  Eventually, you'll get it right!
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         GadgetGuy Super User 
          
  
  Joined: June 01 2008 Location: United States
 Online Status: Offline Posts: 942
          | 
        
         
          
           | Posted: January 07 2009 at 21:59 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Dang!
 
 I hate it when I solve my own problems!
 
 Discovered that I needed quotes ("") around the "0" in 
 the IF boolean test.
 
 After struggling with this for 5 hours and a myriad of 
 various tests, I got to the point where I couldn't tell 
 what was what anymore.  Sometimes a break to pee really 
 helps to clear the mind!
 
    
  __________________ Ken B - Live every day like it's your last.  Eventually, you'll get it right!
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         GadgetGuy Super User 
          
  
  Joined: June 01 2008 Location: United States
 Online Status: Offline Posts: 942
          | 
        
         
          
           | Posted: January 07 2009 at 22:01 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
 
GadgetGuy wrote: 
   
    
    
      
       Dang!
 Discovered that I needed quotes ("") around the "0" in 
 the IF boolean test.
    | 
       
       | 
    
    | 
 
  
 
 REALLY points out the need for a User Manual (which 
 hopefully is in the works).
  __________________ Ken B - Live every day like it's your last.  Eventually, you'll get it right!
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         TonyNo Moderator Group 
          
  
  Joined: December 05 2001 Location: United States
 Online Status: Offline Posts: 2889
          | 
        
         
          
           | Posted: January 07 2009 at 22:44 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Just so you know, in ph_getglobal_s, the s is for string.   
 
 Also, this would work, too.
 
 
Code: 
   
    
    
      
       | if( ph_getglobal_n( ph_getglobal_s( "PAR-FLG"))=0, ph_msgbox( "Var", "0", 15), ph_msgbox( "Var", "1", 15)) | 
       
       | 
    
    | 
 
 
 
 Your indirection intrigues me! What are you doing?    
         | 
       
       
        | Back to Top | 
         
          
          
         | 
       
       
       
        |   | 
      
        
         
         GadgetGuy Super User 
          
  
  Joined: June 01 2008 Location: United States
 Online Status: Offline Posts: 942
          | 
        
         
          
           | Posted: January 08 2009 at 11:06 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
 
TonyNo wrote: 
   
    
    
      
       
 Your indirection intrigues me! What are you doing?    
  | 
       
       | 
    
    | 
 
  
 
 Setting up a CC window where I can control how I want to 
 be notified when Camera Motion is detected.  I have 
 email and SMS choices for each camera and wanted to be 
 able to enable/disable these flags remotely.
 
 Rather than create a macro for each button press, I 
 created an Immediate formula for each button's action 
 that sets a Global Var {BUTTON-STATE} to the Button ID 
 and then calls a macro to evaluate it.
 
 The macros needs the name (direct) of the state flag 
 associated with the Button ID but then needs to access 
 that flag (indirect) to toggle its state. I figured this 
 was easier than making each button action sequence 
 determine its button's state before calling a macro.
 
 This allows me to have a single macro that can handle 
 state toggles for all the buttons on the Control Center.
  __________________ Ken B - Live every day like it's your last.  Eventually, you'll get it right!
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |