Announcement

Collapse
No announcement yet.

Adding a variable to a script, in an event

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

    Adding a variable to a script, in an event

    I have several scripts in events that send url to webhooks in ifttt. I read trough and searched though the forum and cant seem to find an answer to this.

    My scripts are just like this:

    Click image for larger version  Name:	hs script.png Views:	0 Size:	41.7 KB ID:	1369631

    example script:
    &hs.GetURL("https://maker.ifttt.com/trigger/sonos_stop/with/key/ThisIsMyKey","/",TRUE,80)



    in this script is the key used for my webhoooks account. In my example script say the key is: 'ThisIsMyKey' Every now and then I change that key (usually by mistake). When I change that key I have to re-enter it in every script that I use it in, 20+. I have tried to creating a global variable (string) and inserting the variable name, but I cant seem to find a format that works.

    Is there a simple way to do this? Something like this?

    &hs.GetURL("https://maker.ifttt.com/trigger/sonos_stop/with/key/{GLOAL VARIABLE KEY}","/",TRUE,80)

    I want to stay simple, and not adding program calls or anything like that. Hopefully I am missing something very obvious and simple

    Thanks for any help!

    #2
    I haven't tried it, but you could put your key in the device string of a virtual device and then concatenate it to the Get command.
    If the RefID of the device is 1234 then the immediate script command would look like this:
    &hs.GetURL("https://maker.ifttt.com/trigger/sonos_stop/with/key/" & hs.DeviceString(1234),"/",TRUE,80)
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

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

    Comment

    Working...
    X