Absent Member.. Absent Member..
Absent Member..
281 views

LogFile Entry - Using vbs script in Log File Path

Jump to solution

Hello,

I created an .pl script for linux and din't have problem.

The problem is when I'm trying to use vbs script to do the same in Windows.

I created a script that I call using:

<`cscript /nologo C:\temp\BVMFFileNameSerialize.vbs %%ROOT_FOLDER%% %%REGEX_LOGS%%`>

Inside the script I have:

'############################################################
'# 
'# HP OMI Management Pack for BM&F BOVESPA 1.00.0000 05/11/16
'#
'# File Name Serializer (Regex)
'#
'############################################################

Resultado = ""
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
strCurrentDirectory = objShell.CurrentDirectory

Set objFolder = objFS.GetFolder(WScript.Arguments(0))
Set colFiles = objFolder.Files

Set objRE = New RegExp
objRE.Global     = True
objRE.IgnoreCase = False
objRE.Pattern    = WScript.Arguments(1)
...
Resultado = Resultado + WScript.Arguments(0) + "\" + objFile.Name + " "
...
WScript.Echo """" + Left(Resultado,Len(Resultado)-1) + """"

So I have in the result for example this:

"C:\temp\outro.log"

when only one file is found, works properly.

the problem is when find more than one file. like this:

"C:\temp\outro.log C:\temp\outro04072016.log"

I receive the message:

Cannot open file C:\temp\outro.log C:\temp\outro04072016.log.
System Error Number: 2 (2) - The system cannot find the file specified.
 (OpC20-63)

I tried to remove "", I tried to include "" for each log, tried to do the same before with "" in the beggining and in the end.

I don't know what OMi expect from my output.

someone could explain How I need to ouput the logs name to this policy understand my list?

Regards,

 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Absent Member.. Absent Member..
Absent Member..

I found by my self.

The correct way to pass the logfile name in result is using "" between each log file and use stdout in vbs.

Set fso = CreateObject ("Scripting.FilesystemObject")
Set stdout = fso.GetStandardStream (1)
stdout.writeLine Left(Resultado,Len(Resultado)-1) 

Result:

c:\temp>cscript /nologo BVMFFileNameSerialize.vbs c:\temp ^outro.*log
"c:\temp\outro.log" "c:\temp\outro04072016.log"

I hope this help other people because I couldn't found this information any documentation and here.

View solution in original post

1 Reply
Absent Member.. Absent Member..
Absent Member..

I found by my self.

The correct way to pass the logfile name in result is using "" between each log file and use stdout in vbs.

Set fso = CreateObject ("Scripting.FilesystemObject")
Set stdout = fso.GetStandardStream (1)
stdout.writeLine Left(Resultado,Len(Resultado)-1) 

Result:

c:\temp>cscript /nologo BVMFFileNameSerialize.vbs c:\temp ^outro.*log
"c:\temp\outro.log" "c:\temp\outro04072016.log"

I hope this help other people because I couldn't found this information any documentation and here.

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.