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!

Screen Capture to String

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
I have a project for a Rolm 9005 switch that requires the following.

I need to modify the COS fo a couple thousand extensions. However, I cannot us a waitfor because of the way information is displayed.

I was thinking if i could capture certain charicters to a variable. Please see the example below:

COMMAND: MOD EXTEN 1001


FORWARD ON
SYSTEM FORWARDING BSY RNA DND
EXTN TYPE COS TARGET 1 TARGET 2 TARGET 3 TARGET 4 I E I E I E RINGDOWN
------- ---- --- -------- -------- -------- -------- - - - - - - --------
DF > > 0 - - - - - -
MD 1001 EXT 3 - - - - - -


ACD NAME
- ----------------
DF N
MD N 0PEN

COMMAND:


You get to the COS area with the Enter Key (i.e., you hit Enter Twice), then type in the New COS.

Is there a way I can Capture say the first 17 characters to a variable (OldCosNum): the Characters I would probably want are: MD 1001 EXT 3

Please note that the EXTN field can be up to 7 digits.
Please note that the COS field can be up to 2 digits.
Please note the TYPE Field is always either: EXT, MUS, SOFT

I already have a script to read extensions from a file.
and transmit required information. However, I need to ensure that I am at the Right Extension Number before executing the Change.

Any and all suggestions would be most welcome.
 
I'm not familiar with the device you are connecting to, but is there a constant string you could key off of to determine that you are near the information you are seeking, such as the "EXTN TYPE COS TARGET 1 TARGET 2 TARGET 3 TARGET 4 I E I E I E RINGDOWN" header? If so, you could save the current screen to a text file using the snapshot command, reading it line by line until you read the correct line (for example, three lines below the header). You would then have the entire line with
"MD 1001 EXT 3 - - - - - -" You could then use the strtok command (keying off the spaces) to break the line into several string variables each containing the various portions of the string. You could also multiple rget commands to read data directly from the port instead of parsing a snapshot file (this would cause the data to not appear on the screen if that is an issue).


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top