Announcement

Collapse
No announcement yet.

If and more If Statement / Script help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    If and more If Statement / Script help

    Hi I have two if statements one after the other but only the first one will run when either device is off by name. I need the next if hs.isOffbyName (Status Mustang) to run as well. any one see a better way to do this?

    **Note I have two different Toaddresses and conditions that I need to run.
    see below:

    PHP Code:
    '**********************************************************************************************
        If notify Then
    '
    ***********************************************************************************************
    'PAP Auto Status deactivates email of CNN news when device status Is On
         If hs.IsOffByName ("Status MKZ")Or hs.IsOffByName ("Status GXP")Then
         hs.SendEmail(TOaddress, FROMaddress, subject, msg)
           dbg("email notification to Paul been sent")
    '
    **********************************************************************************************
        if 
    hs.IsOffByName ("Status Mustang")Then
           hs
    .SendEmail(TOaddress2FROMaddresssubjectmsg)
           
    dbg("email notification to Alice has been sent")
    '***********************************************************************************************
    '
    PAP Sends CNN Alert in a IM 
          IM_Connector
    .SendMessage(IMaddresssubject &  msg chr(13))
         
    dbg("IM notification has been sent")
    '***********************************************************************************************
           End If
        End If
       End If   
      End Sub 
    HS2 Environment
    Zotac 1.83 GHz Quadcore
    HomeSeer Way2Call
    Netiom-Xap board
    opnode 1-wire 1.2.7
    Plug-In's
    WeatherXML 1.0.0.32
    Pwr Link USB 1.0.0.13
    mcsTemp V6.2.0.14
    mcsXap V3.0.0.0/3.0.0.20
    IM Connector 4.87.2.5
    Sip Connector 2.56.2.4
    RFXCOM 15.0.0.22
    Odroid X2
    Asterisk 11.5.1
    FreePBX 2.11.0.42
    WebMin 1.720
    Xap Switchboard by Mi4

    There is no place Like 127.0.0.1

    #2
    Maybe a different grouping of the If statements and their closure End If will help

    Code:
    [COLOR=#007700][COLOR=#000000][COLOR=#0000bb][/COLOR][COLOR=#dd0000][FONT=Courier New]'**********************************************************************************************
        If notify Then
    '[/FONT][/COLOR][COLOR=#007700][FONT=Courier New]***********************************************************************************************
    [/FONT][/COLOR][COLOR=#dd0000][FONT=Courier New]'PAP Auto Status deactivates email of CNN news when device status Is On
         If hs.IsOffByName ("Status MKZ" Or hs.IsOffByName ("Status GXP")Then
         hs.SendEmail(TOaddress, FROMaddress, subject, msg)
           dbg("email notification to Paul been sent")[/FONT][/COLOR][/COLOR][/COLOR]
    [COLOR=#007700][COLOR=#000000][COLOR=#dd0000][FONT=Courier New]End If
    '[/FONT][/COLOR][FONT=Courier New][COLOR=#007700]**********************************************************************************************
        if [/COLOR][COLOR=#0000bb]hs[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]IsOffByName [/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"Status Mustang"[/COLOR][COLOR=#007700])[/COLOR][/FONT][FONT=Courier New][COLOR=#0000bb]Then
           hs[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]SendEmail[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]TOaddress2[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]FROMaddress[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]subject[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]msg[/COLOR][/FONT][FONT=Courier New][COLOR=#007700])
           [/COLOR][COLOR=#0000bb]dbg[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"email notification to Alice has been sent"[/COLOR][/FONT][COLOR=#007700][FONT=Courier New]) [/FONT][/COLOR][/COLOR][/COLOR]
    [COLOR=#007700][COLOR=#000000][COLOR=#007700]End If[/COLOR][/COLOR][/COLOR]
    [COLOR=#007700][COLOR=#000000][COLOR=#007700][/COLOR][COLOR=#dd0000][FONT=Courier New]'***********************************************************************************************
    '[/FONT][/COLOR][FONT=Courier New][COLOR=#0000bb]PAP Sends CNN Alert in a IM 
          IM_Connector[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]SendMessage[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]IMaddress[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]subject [/COLOR][COLOR=#007700]&  [/COLOR][COLOR=#0000bb]msg [/COLOR][COLOR=#007700]& [/COLOR][COLOR=#0000bb]chr[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]13[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]))
         [/COLOR][COLOR=#0000bb]dbg[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"IM notification has been sent"[/COLOR][/FONT][COLOR=#007700][FONT=Courier New])
    [/FONT][/COLOR][COLOR=#dd0000][FONT=Courier New]'***********************************************************************************************
    [/FONT][/COLOR][/COLOR][/COLOR]
    [COLOR=#007700][COLOR=#000000][COLOR=#dd0000][FONT=Courier New]   End If   
      End Sub  [/FONT]
    [/COLOR][/COLOR][/COLOR]

    - Bram

    Send from my Commodore VIC-20

    Ashai_Rey____________________________________________________________ ________________
    HS3 Pro 3.0.0.534
    PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | BLBackup | FritzBox | Z-Wave | mcsMQTT | AK Ikea

    Comment


      #3
      Thank You that worked perfectly !!!
      HS2 Environment
      Zotac 1.83 GHz Quadcore
      HomeSeer Way2Call
      Netiom-Xap board
      opnode 1-wire 1.2.7
      Plug-In's
      WeatherXML 1.0.0.32
      Pwr Link USB 1.0.0.13
      mcsTemp V6.2.0.14
      mcsXap V3.0.0.0/3.0.0.20
      IM Connector 4.87.2.5
      Sip Connector 2.56.2.4
      RFXCOM 15.0.0.22
      Odroid X2
      Asterisk 11.5.1
      FreePBX 2.11.0.42
      WebMin 1.720
      Xap Switchboard by Mi4

      There is no place Like 127.0.0.1

      Comment

      Working...
      X