ECS-L Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
parse to Number
A.J. Griglak
Wed, 1 Mar 2000 11:30:06 -0500
Wed, 1 Mar 2000 11:30:06 -0500
I'd like to take a number from a text file (parsed from a web page) and have
it transferred into a Number Item in ECS.  I've searched the archives, and
looked through the EXAMPLE.CFG - I'd assume that it would be similar to how
the TVL channel is picked up, but I can't get it to work, not to mention I
don't know what's going on with all the calculations - subtracting 48,
multiplying by 10, etc.  Does each line of
Do    Text-B    Set    Text_Item1
increment one character further in the text file?

Specifically, the text file I would like to translate into a number is
parsed from the weather.com site - it's the current temperature.  (The poor
man's external temperature sensor).  After parsing, the text file has a
bunch of leading spaces and then the temperature like this - xxdegrees.

Here's my thinking:  I would read the file in one character at a time, make
sure it is a number, then translate that number into an ECS number.  I've
been trying dozens of different things - here is the best one (I think) that
I came up with:


;Temporary Trigger   (wx:cur temp is the file item)
If         Button-A             Is Now     4/On
Do         Character-A          Set        wx:cur temp

If         Character-A          Is         None
Then       Sys:Event-Exit       Set        True

;Find the numbers:
WHILE      Character-A          Is GT      9
Or         Character-A          Is LT      0
Do         Character-A          Set/Char   Text-A
ENDWHILE

;Translate the numbers:
WHILE      Character-A           Is Not   d
Do         Text-A               Set        Re-Define Text
Do         Text-A               Set        wx:curtemp ch 1
Do         Text-A               Set        wx:curtemp ch 2
Do         Text-A               Set        wx:curtemp ch 3
Do         wx:cur_temp#         Stt<-T1    Text-A
ENDWHILE.


Help please!!

-=A.J.


I'd like to take a number from a text file (parsed from a web page) and have it transferred into a Number Item in ECS.  I've searched the archives, and looked through the EXAMPLE.CFG - I'd assume that it would be similar to how the TVL channel is picked up, but I can't get it to work, not to mention I don't know what's going on with all the calculations - subtracting 48, multiplying by 10, etc.  Does each line of
Do    Text-B    Set    Text Item1
increment one character further in the text file?
 
Specifically, the text file I would like to translate into a number is parsed from the weather.com site - it's the current temperature.  (The poor man's external temperature sensor).  After parsing, the text file has a bunch of leading spaces and then the temperature like this - xxdegrees.
 
Here's my thinking:  I would read the file in one character at a time, make sure it is a number, then translate that number into an ECS number.  I've been trying dozens of different things - here is the best one (I think) that I came up with:
 
 
;Temporary Trigger   (wx:cur temp is the file item)
If         Button-A             Is Now     4/On
Do         Character-A          Set        wx:cur temp
 
If         Character-A          Is         None
Then       Sys:Event-Exit       Set        True
 
;Find the numbers:
WHILE      Character-A          Is GT      9
Or         Character-A          Is LT      0
Do         Character-A          Set/Char   Text-A
ENDWHILE
;Translate the numbers:
WHILE      Character-A           Is Not   d
Do         Text-A               Set        Re-Define Text
Do         Text-A               Set        wx:curtemp ch 1
Do         Text-A               Set        wx:curtemp ch 2
Do         Text-A               Set        wx:curtemp ch 3
Do         wx:cur temp#         Stt<-T1    Text-A
ENDWHILE.
 
 
Help please!!
 
-=A.J.

  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.