Announcement

Collapse
No announcement yet.

Pulling hair w/ what should be simple script!

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

    Pulling hair w/ what should be simple script!

    Hello all,

    please help. After 2 hours of trying to create a simple script, I keep running into walls. Finally, I decided to yell "uncle" and post my question.

    I need to get a URL, while passing the variable which is the device status string.

    My device, "Music_Radio1"Selection" [see image] is currently set to "Classical Music". The URL I'd like HS to retreive is:

    Web Page: http://192.168.4.10:8888/play.php?ty...ssical%20Music

    I'm trying to append the URL "/play.php?type=" and the string value from element 1138 which is "Music_Radio1"Selection". For simplicity, I'm using immediate script notation and I've tried the following with no success:
    &hs.GetURL("192.168.4.40",("/play.php?name=" & hs.DeviceString(1138)) ,TRUE,8888)

    I've tried "+" instead of the "&" and same results. While there are no errors reported in HS, the web server shows the [VARIABLE] as blank, so the request just ends with "name=". I've searched the forums and tried all sorts of permutations and actual scripts, but then i get different errors, so thought i'd re-focus on back to the basics and ask for help.

    What am I missing or doing wrong?

    thank you,

    Marco
    Attached Files

    #2
    This is a subtle little difference with HS3 compared to HS2, what you think of as the device string (ie Classical Music as displayed in the UI) is not the string, it is actually the status. That status is solely dependent on the devices value, the device string in HS3 is really only used when trying to store complex data (like HTML) in the device UI area.

    Does;

    &hs.GetURL("192.168.4.40",("/play.php?name=" & hs.CAPIGetStatus(1138).Status) ,TRUE,8888)

    Work?

    Comment


      #3
      Brilliant!!

      It worked. Thank you.

      Comment

      Working...
      X