Announcement

Collapse
No announcement yet.

Help with decimal point in script

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

  • Help with decimal point in script

    I'm trying to write a script to send myself the latitude and longitude supplied by the phLocation plugin.

    The plugin stores the latitude and longitude values as floats - eg 123.45678

    It looks like this when I check the device

    Value -123.45678 = "-123.45678"

    but when I retrieve this using hs.DeviceValue it rounds to 123. The string field is empty so I can't get it from there. I tried multiplying the value by 1000 as in

    Dim myval
    myval = hs.DeviceValue(100) * 1000
    hs.speak(myval)

    but that still rounds.

    Any idea how I can get the full float value?

    Thanks!

  • #2
    Try:
    Dim myval as Double
    myval = hs.DeviceValueEx(100)

    DeviceValue returns an integer, so it truncates the value.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

    Comment


    • #3
      Nailed it!


      Thanks!


      mark

      Comment

      Working...
      X