Announcement

Collapse
No announcement yet.

Immediate Script Command Help

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

    Immediate Script Command Help

    Hello,

    Can someone advise why this simple immediate script command....

    &INTR=HS.PING(8.8.8.8);HS.WRITELOG("Internet","STATUS="& INTR)

    ...yields this error:
    Mar-24 6:05:34 PM Error Running script(2) &INTR=HS.PING(8.8.8.8);HS.WRITELOG("Internet","STATUS="& INTR), init error: Expected ')'
    Where does it expect another ) ?


    Jim Speiser
    38-year veteran of Home Automation
    Still don't know squat

    #2
    There is a lot going on there. I'm not sure you can declare and use a variable in an immediate script command. I also think the separator between commands is ":" for both vbscript and vb.net. Also, hs.ping takes a string as a parameter so 8.8.8.8 likely is being cast as an something else. HS Ping also returns 1 or 0, so your log even if this works will say STATUS=1 or STATUS=0.

    FWIW, this executes OK - &HS.WRITELOG("Internet","STATUS=" & HS.PING("8.8.8.8"))

    Mar-24 8:44:06 PM Internet STATUS=0
    Mar-24 8:44:06 PM System Control Panel Immediate Script: &HS.WRITELOG("Internet","STATUS=" & HS.PING("8.8.8.8"))

    This immediate command will give you "Status=OK" or "Status=Ping Failed"

    &nHS.WRITELOG("Internet","STATUS=" & IF(HS.PING("8.8.8.8") = 0, "OK", "Ping Failed"))

    Mar-24 8:53:54 PM Internet STATUS=Ping Failed
    Mar-24 8:53:54 PM System Control Panel Immediate Script: &nHS.WRITELOG("Internet","STATUS=" & IF(HS.PING("8.8.8.254") = 0, "OK", "Ping Failed"))
    Mar-24 8:53:28 PM Internet STATUS=OK
    Mar-24 8:53:28 PM System Control Panel Immediate Script: &nHS.WRITELOG("Internet","STATUS=" & IF(HS.PING("8.8.8.8") = 0, "OK", "Ping Failed"))

    Comment


      #3
      Shouldn't this be a : instead of a ; when using multiple commands on one line?
      PING(8.8.8.8) -> ; <- HS.WRITELOG
      - 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


        #4
        Well, golly, other than all THAT, it's OK, right?

        I can't remember where I got this, it's someone else's coding, I just thought I could cram it into an immediate. I'll try your suggestions, and thanks for the input.


        Jim Speiser
        38-year veteran of Home Automation
        Still don't know squat

        Comment

        Working...
        X