I'm using the following code to set a Philips Hue bulb with specific hue, saturation and brightness using Applescript. It works perfectly.
set TurnOnBulbA to the quoted form of "{\"on\": true,\"hue\": 65535, \"sat\": 240,\"bri\": 90}"
I'd like to add a random color option. This seems like it should insert a random number for the hue setting, but instead, it inserts the name of the variable:
set RandomNumA to (random number from 0 to 65535)
set TurnOnBulbA to the quoted form of "{\"on\": true,\"hue\": RandomNumA, \"sat\": 240,\"bri\": 90}"
How do I insert the generated number of the variable instead of the name of the variablel?
The following probably isn't needed, but I'll include it in case it's helpful to anybody. It's the code that completes the above for turning on a bulb:
do shell script "curl --request PUT --data " & TurnOnBulbA & " http://myIPaddress/api/myhueID/lights/1/state/"
Aucun commentaire:
Enregistrer un commentaire