Announcement

Collapse
No announcement yet.

Current date to device string

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

  • alexbk66
    replied
    I use script, but one liner:

    Code:
    &nhs.SetDeviceStringByName("Time", now.ToString("HH:mm"), True) &
    hs.SetDeviceStringByName("Date", now.ToString("ddd. MMM  dd"), True)
    Click image for larger version

Name:	Capture.PNG
Views:	48
Size:	6.9 KB
ID:	1280791

    Leave a comment:


  • lpcalcaterra
    replied
    It seems unnecessary to do a script for such a thing, but did it anyway:
    d=Now()
    d2=Format(d,"dddd, MMMM-d-yyyy")
    hs.writelog ("date info",d2)
    hs.setdevicestring(891,d2,true)

    Thanks Jon for your input.

    Leave a comment:


  • jon00
    replied
    You can use:

    hs.setdevicestring(891,"Today is " & hs.replacevariables("$date"),true)

    Leave a comment:


  • prsmith777
    replied
    Yeah I think you're right. You could use :


    hs.setdevicesting(891,"Today is " & now() ,true) but you probably wouldn't want that format.

    Looks like you're going to have to use a script to get it to work.

    Leave a comment:


  • lpcalcaterra
    replied
    thanks for catching my typos. It does not look like I can set a device to from a replacement variable.

    Running script(1) &hs.setdevicestring(891,$date),true, init error: Invalid character

    Leave a comment:


  • prsmith777
    replied
    try setdevicestring not setdevicesting

    Edit:

    Notice your parentheses arent right

    hs.setdevicesting(891,"Today is $date",true)

    But this doesnt seem to put the replacement variable in the string.
    Last edited by prsmith777; December 13th, 2017, 03:22 PM.

    Leave a comment:


  • lpcalcaterra
    started a topic Current date to device string

    Current date to device string

    I would like to get the current date into a device string. The HS replacement variable $date has the info, but I am not sure how to get into device.

    &hs.setdevicesting(891,"Today is $date"),true - throws an error
Working...
X