| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | RE: [ECS] Programming Question Michael David Sun, 23 Jan 2000 18:17:03 -0500 |
Hi Bill! Any special reason you are using a file to get the show names to ACE buttons? Here's how I do it: |Item::BTN: Type:Number Acc:Owner/Owner | Initial State:(none) Backup:No | ; we use the name of this item in our string we send to ACE. | ; we use it's value only as a pass number for the while | ; statement below. |Item:ACEC: Type:Number Acc:User/User | Initial State:(none) Backup:No | ; we use the name of this item in our string we send to ACE | ; we also use it value in that string to determine which client | ; gets the command. |Item:ACE Page Type:Number Acc:User/User | Initial State:(none) Backup:No | ; we use the state of this item in our string we send to ACE | ; to determine which page the button is on. |Item:ACE Group Type:Number Acc:User/User | Initial State:(none) Backup:No | ; we use the state of this item in our string we send to ACE | ; to determine which group holds the target page. |Item:Text to ACE Type:Text Acc:Owner/Owner | Initial State:(none) Backup:No | Text :ACEC:0:BTN:8,1,0,Stargete SG-1 | ; The string we are sending. |Item:"," Type:Text Acc:Owner/Owner | Initial State:(none) Backup:No | Text :, | ; a simple comma... | ; The following are text items that hold the name of the program | ; to be sent to ACE. |Item:PGM Show 1 Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :Star Trek: Voyager |Item:PGM Show 2 Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :JAG |Item:PGM Show 3 Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :Stargate SG-1 |Item:PGM Show 4 Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 5 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 6 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 7 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 8 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 9 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 10 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 11 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 12 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 13 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 14 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 15 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 16 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 17 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 18 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 19 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:Pgm 20 TV Show Type:Text Acc:User/Owner | Initial State:(none) Backup:No | Text :-- |Item:ACE.Log Type:State-Log Acc:Owner/Owner | Initial State:(none) Backup:No | File :ACE.LOG | ; we log all commands sent to ACE |Event: ACE TVP Current Called ?:Yes | Do :BTN: Set 1 | Do ACEC: Set 0 | Do ACE Page Set 0 | Do ACE Group Set 8 | | WHILE :BTN: Is LE 20 | ; we have to Subtract 1 from BTN since ACE starts counting at 0 | Do :BTN: Subtract 1 | Do Text to ACE T1<-Nam ACEC: | Do Text to ACE T1/A<-Stt ACEC: | Do Text to ACE T1/A<-Nam :BTN: | Do Text to ACE T1/A<-Stt ACE Page | Do Text to ACE T1/A<-T1 "," | Do Text to ACE T1/A<-Stt ACE Group | Do Text to ACE T1/A<-T1 "," | Do Text to ACE T1/A<-Stt :BTN: | Do Text to ACE T1/A<-T1 "," | ; We have to add it back in now... | Do :BTN: Add 1 | | If :BTN: Is 1 | Then Text to ACE T1/A<-T1 Pgm 1 TV Show | Else If :BTN: Is 2 | Then Text to ACE T1/A<-T1 Pgm 2 TV Show | Else If :BTN: Is 3 | Then Text to ACE T1/A<-T1 Pgm 3 TV Show | Else If :BTN: Is 4 | Then Text to ACE T1/A<-T1 Pgm 4 TV Show | Else If :BTN: Is 5 | Then Text to ACE T1/A<-T1 Pgm 5 TV Show | Else If :BTN: Is 6 | Then Text to ACE T1/A<-T1 Pgm 6 TV Show | Else If :BTN: Is 7 | Then Text to ACE T1/A<-T1 Pgm 7 TV Show | Else If :BTN: Is 8 | Then Text to ACE T1/A<-T1 Pgm 8 TV Show | Else If :BTN: Is 9 | Then Text to ACE T1/A<-T1 Pgm 9 TV Show | Else If :BTN: Is 10 | Then Text to ACE T1/A<-T1 Pgm 10 TV Show | Else If :BTN: Is 11 | Then Text to ACE T1/A<-T1 Pgm 11 TV Show | Else If :BTN: Is 12 | Then Text to ACE T1/A<-T1 Pgm 12 TV Show | Else If :BTN: Is 13 | Then Text to ACE T1/A<-T1 Pgm 13 TV Show | Else If :BTN: Is 14 | Then Text to ACE T1/A<-T1 Pgm 14 TV Show | Else If :BTN: Is 15 | Then Text to ACE T1/A<-T1 Pgm 15 TV Show | Else If :BTN: Is 16 | Then Text to ACE T1/A<-T1 Pgm 16 TV Show | Else If :BTN: Is 17 | Then Text to ACE T1/A<-T1 Pgm 17 TV Show | Else If :BTN: Is 18 | Then Text to ACE T1/A<-T1 Pgm 18 TV Show | Else If :BTN: Is 19 | Then Text to ACE T1/A<-T1 Pgm 19 TV Show | Else If :BTN: Is 20 | Then Text to ACE T1/A<-T1 Pgm 20 TV Show | | Do Text to Ace Set Send->ID:D | | Do ACE.Log Set Text to ACE | | Do :BTN: Add 1 | ENDWHILE | End Hope that helps! Cheers! Michael David michael@michaeldavid.com -----Original Message----- From: Bill Walters [mailto:wtwalters@home.com] Sent: Sunday, January 23, 2000 3:35 PM To: ecs-list@netbloc.com Subject: [ECS] Programming Question All - I'm a little perplexed with a task I want to do. I'm asking for guideance or pointers towards a solution. As I don't typically mess around with "Files" too much, I haven't got a good handle on ECS's capability for dealing with them... Here's what I'm trying to do.... 1. I have created simple batch files to "parse" selected channels from TV-GUIDE.TXT file into various files, called CHN1.LST, CHN2.LST, etc. That part works just fine. 2. I am attempting to build an ACE command, which will use these files, to re-define various BUTTONS. The idea is that I can have a button for each "desired" channel, and have ECS update the captions on these buttons with the shows currently showing. Pressing the desired button, will change the TV or SAT receiver to that channel.. The Caption for HBOP button, for today is 2 lines, so would look like this: - 01/23 Sunday 11:30a 135 G5-08 HBOP John Grisham's The Rainmaker - 01/23 Sunday 01:45P 135 G5-08 HBOP Without a Trace 3. Methodology so far is to define items for the 1st part of the ACE redefine button command, and the last part of the ACE redefine button command, and add in the caption thusly: Items - ACE Test is True/False HBO1.LST is File, and file is defined as HBO1.LST HBO1 Caption is Text item ACE Btn HBO1 is Text item and holds the 1st part of redefine button API command ACE Btn end is Text item and holds the last part of redefine button API command (the part that goes after the button caption text) |Event: ACE Movie Buttons Called ?:No | If Ace Text Is Not True | Then Event-Exit Set True | | Do Character-A Set HBO1.LST | Do HBO1 Caption Set Re-Define Text | | WHILE Character-A Is Not None | Do HBO1 Caption Set Character-A | Do Character-A Set HBO1.LST | ENDWHILE | | Do HBO1.LST Set Rewind | Do Ace Text T1<-T1 ACE Btn HBO1 | Do Ace Text T1/A<-T1 HBO1 Caption | Do Ace Text T1/A<-T1 ACE Btn end | Do Ace Text Set Send->ID:A | Do Ace Test Set False | End THE PROBLEM with all of this is that the WHILE/ENDWHILE statements "choke" when they get to CR/LF, also, TEXT items (HBO1 Caption) are limited in size; 2 lines "overflows" so think I should be using some sort of "file" item here too, because the "Ace Text" item will surely exceed the 128 (or whatever) characters is defined as the maximum.... As if anyone else cares at this point, the "final" command to resize the ACE button for this particular example would look like: ACEC:0:BTN:1,5,0,- 01/23 Sunday 11:30a 135 G5-08 HBOP John Grisham's The Rainmaker - 01/23 Sunday 01:45P 135 G5-08 HBOP Without a Trace,,,,,,,,1 Arraugh....... where's that "Primer" project I was talking about this time last year!!!!!! I need a chapter "for dummies" on re-define text, when used with Files..... Coments? Suggestions? Pointers??? Bill Walters