How do I “report” a value in plain text with vbs?? 
Author Message
 How do I “report” a value in plain text with vbs??

In short, I have a monitoring program that checks log files for certain errors.
The log files changes name every day but there is an option in the monitoring
program that allows you to create a script that looks up the path and filename
and then opens the file.

I have (with great help from Robert Cohen) created a script that looks up
todays date and then attach that date to a file. This works but when I try to
add the script into my monitoring program it doesnt like it. I need to script
to basically return the value in plain text format (not in a pop-up text box).
Basically I want it to report the path (and ONLY the path) if I run the script
from a dos prompt. Can this be done? And if so how? Below is the script I have
come up with so far.

If anyone has any ideas on what I can do here let me know.

--------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")

oMonth= DatePart("m", Now())  ' looks up todays month
oday= DatePart("d", Now())    ' looks up todays day

if oMonth <10 and oday <10 Then ' adds "0" if month and date is single digits
oFilename= "c:\Data\Logs\file0" & omonth &"0" & oday & ".log"
Elseif oMonth <10 Then  ' adds "0" if month is single digit oFilename=
"c:\Data\Logs\file0" & omonth & oday & ".log"
Elseif oday <10 Then  ' adds "0" if date is single digit oFilename=
"c:\Data\Logs\file" & omonth &"0" & oday & ".log"
Else                            ' creates correct path
        oFilename= "c:\Data\Logs\file" & omonth & oday & ".log"
End IF

If objFSO.FileExists(oFilename) Then
         ' This is where the DOS Plain Text reporting would Go

End If

--------------------------



Wed, 07 Dec 2005 00:27:27 GMT  
 How do I “report” a value in plain text with vbs??

Quote:
> In short, I have a monitoring program that checks log files for
> certain errors. The log files changes name every day but there is an
> option in the monitoring program that allows you to create a script
> that looks up the path and filename and then opens the file.

> I have (with great help from Robert Cohen) created a script that looks
> up todays date and then attach that date to a file. This works but
> when I try to add the script into my monitoring program it doesnt
> like it. I need to script to basically return the value in plain text
> format (not in a pop-up text box). Basically I want it to report the
> path (and ONLY the path) if I run the script from a dos prompt. Can
> this be done? And if so how? Below is the script I have come up with
> so far.

If you set the default scripting host to CSCRIPT, then any "wscript.echo"
commands will send to standard output instead of popping up a message box.
Type
   CSCRIPT //H:CSCRIPT
alone at a command prompt.

--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th
Centurary Europe. Understand it, and you can travel to places you never
heard of and still understand some people." -- Alex K. Angelopoulos



Wed, 07 Dec 2005 00:48:11 GMT  
 How do I “report” a value in plain text with vbs??

Quote:


>> In short, I have a monitoring program that checks log files for
>> certain errors. The log files changes name every day but there is an
>> option in the monitoring program that allows you to create a script
>> that looks up the path and filename and then opens the file.

>> I have (with great help from Robert Cohen) created a script that looks
>> up todays date and then attach that date to a file. This works but
>> when I try to add the script into my monitoring program it doesnt
>> like it. I need to script to basically return the value in plain text
>> format (not in a pop-up text box). Basically I want it to report the
>> path (and ONLY the path) if I run the script from a dos prompt. Can
>> this be done? And if so how? Below is the script I have come up with
>> so far.

>If you set the default scripting host to CSCRIPT, then any "wscript.echo"
>commands will send to standard output instead of popping up a message box.
>Type
>   CSCRIPT //H:CSCRIPT
>alone at a command prompt.

I actually tried this but unfortunatelly when doing this it also reports the
Microsoft disclaimer and my monioring prg then tries to use that as a path. :(
I need something to JUST report the text and nothing else. :)

Ex.

C:\TEMP>timetest.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

c:\DATA\LOGS\file0620.log

C:\TEMP>



Wed, 07 Dec 2005 01:14:51 GMT  
 How do I “report” a value in plain text with vbs??

Quote:


>> In short, I have a monitoring program that checks log files for
>> certain errors. The log files changes name every day but there is an
>> option in the monitoring program that allows you to create a script
>> that looks up the path and filename and then opens the file.

>> I have (with great help from Robert Cohen) created a script that looks
>> up todays date and then attach that date to a file. This works but
>> when I try to add the script into my monitoring program it doesnt
>> like it. I need to script to basically return the value in plain text
>> format (not in a pop-up text box). Basically I want it to report the
>> path (and ONLY the path) if I run the script from a dos prompt. Can
>> this be done? And if so how? Below is the script I have come up with
>> so far.

>If you set the default scripting host to CSCRIPT, then any "wscript.echo"
>commands will send to standard output instead of popping up a message box.
>Type
>   CSCRIPT //H:CSCRIPT
>alone at a command prompt.

I actually tried this but unfortunatelly when doing this it also reports the
Microsoft disclaimer and my monioring prg then tries to use that as a path. :(
I need something to JUST report the text and nothing else. :)

Ex.

C:\TEMP>timetest.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

c:\DATA\LOGS\file0620.log

C:\TEMP>



Wed, 07 Dec 2005 01:15:23 GMT  
 How do I “report” a value in plain text with vbs??

Quote:
> I actually tried this but unfortunatelly when doing this it also
> reports the Microsoft disclaimer and my monioring prg then tries to
> use that as a path. :( I need something to JUST report the text and
> nothing else. :)

Oh bog.  I did this long, long ago, to get rid of that:

CSCRIPT //NOLOGO //S

--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th
Centurary Europe. Understand it, and you can travel to places you never
heard of and still understand some people." -- Alex K. Angelopoulos



Wed, 07 Dec 2005 01:53:50 GMT  
 How do I “report” a value in plain text with vbs??
Great, that worked, You da man!!  Thanks.
Quote:

>> I actually tried this but unfortunatelly when doing this it also
>> reports the Microsoft disclaimer and my monioring prg then tries to
>> use that as a path. :( I need something to JUST report the text and
>> nothing else. :)

>Oh bog.  I did this long, long ago, to get rid of that:

>CSCRIPT //NOLOGO //S

>--
>Ross Presser -- rpresser AT imtek DOT com
>"... VB is essentially the modern equivalent of vulgar Latin in 13th
>Centurary Europe. Understand it, and you can travel to places you never
>heard of and still understand some people." -- Alex K. Angelopoulos



Wed, 07 Dec 2005 02:30:33 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Creating e-mail is always Rich Text NOT Plain Text

2. Converting formatted text to plain text

3. Mapping plain text to rich text?

4. saving rich text box as plain text

5. Saving Rich Text Box Control as PLAIN TEXT!!!!

6. SQL in plain VBS

7. Plain Text -> Postscript

8. HELP NEEDED: Software to transform plain text files (UNIX) to PDF

9. plain text

10. Format plain text using JScript?

11. sample code needed to open plain text file and use as excel97 file

12. How to convert into plain text?

 

 
Powered by phpBB® Forum Software