Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Fa-med
2019-02-14T10:54:28Z
Hello,

I'm busy with a vbscript and have several problems with it, for now i think dat VisualCron is th etool for it.
But the most of the script i can convert, only the check i do is the problem for me.

	
Function ReadLog(oPath, logfile, pattern)
		Dim oFS, textFile, colMatches
		Dim locFile, strMatch, strSearchString
		
		YY = 0
		QQ = 0 
		locFile = oPath & Logfile
			
		Set oFS = createobject ("scripting.FileSystemObject")
		Set textFile = oFS.OpenTextFile(LocFile, ForReading)
		Set objRegEx = CreateObject("VBScript.RegExp")
		
		objRegEx.Pattern = pattern
				
		Do until YY = 1
			Do Until textFile.AtEndOfStream
				strSearchString = textFile.ReadLine
		    	Set colMatches = objRegEx.Execute(strSearchString)
				If colMatches.Count > 0 Then
					For Each strMatch In colMatches
						Write2Log EVENT_SUCCESS, " De logfile " & LocFile & " is met succes ingelezen en de service is klaar (ReadLog-Sub)"
						YY = 1
					Next
				Else
				YY = 0
				QQ = QQ + 1
				End If
				
				If QQ = 500000 Then
					Write2Log EVENT_ERROR, "De " & locFile & " is aanwezig, alleen is het process " & LocFile & " nog niet klaar, Script is afgebroken (ReadLog-Sub)"
					eTO = Email1										
					eSubject = "Er is een fout in de " & LocFile & " , de verwerking is nog steeds niet klaar, Check het process, Script is afgebroken"
					eTextBody = "De " & locFile & " op de server is niet aanwezig en het script is afgebroken. Controleer of StreamServe wel draait."
					SendEmail
					WScript.Quit
				End If	
				
			Loop
		Loop
			
		Set oFS = Nothing
		Set locFile = Nothing
		Set textFile = Nothing
		Set colMatches = Nothing
		Set strMatch = Nothing
		Set strSearchString = Nothing
	End Function

The function of this piece of script is the following.
An application is creating a log file and in this file he is telling what he is doing en after completing certain tasks, there will be a line that is telling the application is ready. I'm searching for that line to go to the next step in the script.

On Windows 2016, the script give me problems with this check.

Now my question is, can this be converted to a task within VisualCron.
Sponsor
Forum information
Fa-med
2019-02-14T11:55:24Z
In fact i want to replace the whole VBscript to task within VisualCron, but i don't know i that is the best way to do.
Support
2019-02-15T12:09:57Z
Currently, when it comes to searching for strings inside large log files you are better off with scripts as we do not have any equivalent Task for this.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2019-02-15T12:10:17Z
I am moving this topic to Feature requests forum.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top