Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to distiguish between two similar lines?

Status
Not open for further replies.

cirrus

Technical User
Aug 20, 2003
5
Ok here is my script. The problem is that I only want ONE action per line received but it seems that targets 20 and 22 also cause targets 19 and 21 to be triggered. I am new to this as this is my script. Any suggestions in laymens terms so there is no conflict between 19-22?

modify the code or please give me an example so I can understand.

Thanks,

Here's what I've coded:


proc start
string logs = "dsctemp.txt"
run "c:\dsc\renlog.bat"
pause 5
set capture path "c:\dsc"
set capture file logs
capture on
endproc

proc main

when target 0 "test" call test
when target 1 "Alarm Zone 1" call alarm1 ;Basement magenets
when target 2 "Alarm Zone 2" call alarm2 ;Basement glassbreak
when target 3 "Alarm Zone 3" call alarm3 ;Basement Motion
when target 4 "Alarm Zone 4" call alarm4 ;Front Doors
when target 5 "Alarm Zone 5" call alarm5 ;Kitchen Glassbreak
when target 6 "Alarm Zone 6" call alarm6 ;1st Floor Front Motion
when target 7 "Alarm Zone 7" call alarm7 ;1st Floor Back Motion
when target 8 "Alarm Zone 8" call alarm8 ;2nd Floor Motion
when target 9 "Alarm Restore Zone 1" call alarmr1
when target 10 "Alarm Restore Zone 2" call alarmr2
when target 11 "Alarm Restore Zone 3" call alarmr3
when target 12 "Alarm Restore Zone 4" call alarmr4
when target 13 "Alarm Restore Zone 5" call alarmr5
when target 14 "Alarm Restore Zone 6" call alarmr6
when target 15 "Alarm Restore Zone 7" call alarmr7
when target 16 "Alarm Restore Zone 8" call alarmr8
when target 17 "Armed in" call armed
when target 18 "Opening" call disarmed
when target 19 "Telephone Line Trouble" call telldown
when target 20 "Telephone Line Trouble Restore" call tellup
when target 21 "Bell Circuit Trouble" call sirendown
when target 22 "Bell Circuit Trouble Restore" call sirenup
when target 23 "Cold Start" call coldstart
when target 24 "keypad lockout" call keypad

while 1
yield
endwhile
endproc

proc test
run "c:\winnt\system32\calc.exe"
endproc

proc alarm1
run "c:\dsc\alarm1.bat"
endproc

proc alarm2
run "c:\dsc\alarm2.bat"
endproc

proc alarm3
run "c:\dsc\alarm3.bat"
endproc

proc alarm4
run "c:\dsc\alarm4.bat"
endproc

proc alarm5
run "c:\dsc\alarm5.bat"
endproc

proc alarm6
run "c:\dsc\alarm6.bat"
endproc

proc alarm7
run "c:\dsc\alarm7.bat"
endproc

proc alarm8
run "c:\dsc\alarm8.bat"
endproc

proc alarmr1
run "c:\dsc\alarmr1.bat"
endproc

proc alarmr2
run "c:\dsc\alarmr2.bat"
endproc

proc alarmr3
run "c:\dsc\alarmr3.bat"
endproc

proc alarmr4
run "c:\dsc\alarmr4.bat"
endproc

proc alarmr5
run "c:\dsc\alarmr5.bat"
endproc

proc alarmr6
run "c:\dsc\alarmr6.bat"
endproc

proc alarmr7
run "c:\dsc\alarmr7.bat"
endproc

proc alarmr8
run "c:\dsc\alarmr8.bat"
endproc

proc armed
run "c:\dsc\armed.bat"
endproc

proc disarmed
run "c:\dsc\disarmed.bat"
endproc

proc tellup
run "c:\dsc\tellup.bat"
endproc

proc telldown
run "c:\dsc\telldown.bat"
endproc

proc sirenup
run "c:\dsc\sirenup.bat"
endproc

proc sirendown
run "c:\dsc\sirendown.bat"
endproc

proc coldstart
run "c:\dsc\coldstart.bat"
endproc

proc keypad
run "c:\dsc\keypad.bat"
endproc
 
Unfortunately, this is the way when target works. If an incoming string matches more than one target, all matching cases will be run.

Is there a different or longer string you can key off of for targets 19 and 21? You might try using Procomm's Monitor Window to see if there is a carriage return or other non-printable character appearing after those strings. If so, you could add that character (carriage return is a ^M) to that string in the when target command. To activate this window, select the Data | Monitor Window menu item. Resize the Monitor Window so that you can view the entire width of the window, then click back in the Procomm Plus window so that the Monitor Window does not have focus. Incoming text is displayed in red, while text you send is colored blue.

aspect@aspectscripting.com
 
Do the targets appear sequentially? You could insert "clear target" after 19 and then 20 would still trigger.
 
The data for each target is not always necessarily received in sequence. Sometimes there is other data between.

Can you give me an example of code representing your comment?

Much appreciated.

Nick
 
I think what he is saying is to list the restore codes first then as part of the proc clear "target" to prevent a multiple run.
 
THANKS Knob! There were extra characters which allowed me to differentiate between the similar lines. I made the changes and it works!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top