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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need selective screen capture

Status
Not open for further replies.

monkeyboy58

Technical User
Jul 6, 2005
13
0
0
US
I'm two days into scripting so excuse my question.. I want to capture the system name in 1st line and status and reason from 7th line in string then save to a log file.. repeated 45 times.. How do I selectively pull these 3 pieces of data?


Menu 21 - System Backup SYSTEM 3
- History of Last Event -


Backup Tape Label: 0705Full Last Process Run: Backup

Process Status: OK Reason: Successful

Start Time: 07/06/05 2:00A End Time: 07/06/05 2:07A

Number of Mailboxes: xxx Number of Messages: xxx

Include Messages: Y

Starting Class of Service: 1 Ending Class of Service: 64


Press any key to continue.
 
Usually I find it easiest to save to a text file, then parse that for the information I want. In your case, if the data all fits on one screen, you could use if waitfor "Press any key to continue." to detect the end of the screen, then the snapshot command to save to a text file. Use fopen to open the file, then repeated fgets commands to read through it. You would then use the strfind command to search for constant text on the two lines that you are interested in. You could then use some of the different string manipulation commands like strtok, strextract, and strright to pull the data you are interested in.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top