Need to parse numbers from a variable
Posted: Tue Oct 15, 2019 4:37 pm
Sorry my knowledge and time with python programing is very limited. In order to switch to 7.4, I need to convert an embedded key AppleScript set of commands. I have an old (still operational HA controller) that has temp sensors and other input/output devices connected that when anything changes it sends a number string to Indigo through an RS-232 connection and Cynical Network grabbing the number string. In AppleScript I simply parse either 1 or 2 numbers and put those in a new variable.
My V string usually looks like this: Variable "Vnetworkstring1" =!70736965706861
In the first AppleScript group below it takes the 70 out and puts it in the the new variable (so that can be used in Indigo Control pages)..
The second group takes characters 4 & 5, etc, etc.
Any help on writing a command in python to accomplish this will get my triggers back operational in 7.4, and will be much appreciated.
Thank you.
My V string usually looks like this: Variable "Vnetworkstring1" =!70736965706861
In the first AppleScript group below it takes the 70 out and puts it in the the new variable (so that can be used in Indigo Control pages)..
The second group takes characters 4 & 5, etc, etc.
- Code: Select all
set Bedrmtemp2 to value of variable "Vnetworkstring1"
set myTempbed to (characters 2 thru 3 of Bedrmtemp2) as string
set value of variable "V1tempbed2" to myTempbed
set Livetemp2 to value of variable "Vnetworkstring1"
set myTempLiv to (characters 4 thru 5 of Livetemp2) as string
set value of variable "V1tempLive2" to myTempLiv
set basementtemp to value of variable "Vnetworkstring1"
set myTempbasement to (characters 6 thru 7 of basementtemp) as string
set value of variable "V1tempdown2" to myTempbasement
Any help on writing a command in python to accomplish this will get my triggers back operational in 7.4, and will be much appreciated.
Thank you.