KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Reading the output from an exe

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
Quantum



Joined: 06 May 2004
Posts: 56

PostPosted: Tue Jul 13, 2004 10:12 am    Post subject: Reading the output from an exe Reply with quote

LOL, yep another one. Sorry

I want to have a test that looks at the output from an external program. However this output is not just an errorlevel.

Example.
Quote:

you execute c:\myapp.exe

On the screen it displays the following

Quantum's New App details
-------------------------------
User Count = 6
Date Engine Started = 23/5/04
Data Waiting to Write = 123,455K



So, what I want to be able to do is read in a part of each line into a variable and then make a comparison to that variable. I quess what I am tring to do is a test like if 25 < User count then test = BAD


I am not expecting hostmon to do this, I simply wanted to know if anyone had any cleaver ideas on this, even a program that could split the different elements of the programs' output into a few seperate files.


Hope this is understandable.

Q[/quote]
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Tue Jul 13, 2004 12:05 pm    Post subject: Reply with quote

Looks like you need to use Active Script or better Shell Script test method.
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#script
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#chkShell

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Marcus



Joined: 18 Nov 2002
Posts: 367

PostPosted: Wed Jul 14, 2004 9:37 am    Post subject: Reply with quote

Quote:
I am not expecting hostmon to do this, I simply wanted to know if anyone had any cleaver ideas on this, even a program that could split the different elements of the programs' output into a few seperate files.

Redirect the output to a file (">") and use a for statement on the file. If you redirect the output to the file 'temp.txt', the following code will show the number after the 'User Count =' line.....

Redirect: c:\myapp.exe > temp.txt


Code:
@echo off
for /f "eol=; tokens=1* delims=" %%i in (temp.txt) do (call :ShowUserCount %%i)
goto :EOF

:ShowUserCount
 if /I "%1 %2" == "User Count" echo %3
goto :EOF


This means you have the count available (%3 in ShowUserCount function), which means you can create a script which does all the logic for you (and report the result back to HostMonitor).
Back to top
View user's profile Send private message
Quantum



Joined: 06 May 2004
Posts: 56

PostPosted: Mon Aug 02, 2004 5:13 am    Post subject: Reply with quote

Thanks Marcus

This looks like a batch file to me, is that the case or is it VB script.

Sorry not a progammer
-Q
Back to top
View user's profile Send private message
Marcus



Joined: 18 Nov 2002
Posts: 367

PostPosted: Mon Aug 02, 2004 5:23 am    Post subject: Reply with quote

It's a batch file
Back to top
View user's profile Send private message
Quantum



Joined: 06 May 2004
Posts: 56

PostPosted: Mon Aug 02, 2004 5:31 am    Post subject: Reply with quote

Thanks



-Q
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index