Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:vbscript_tool

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bw:vbscript_tool [2020/05/20 16:50]
akoehler [Day of the week (1=Sun - 7=Sat)]
bw:vbscript_tool [2022/08/02 16:42] (current)
akoehler
Line 518: Line 518:
 END IF END IF
 </code> </code>
 +==== Find and Replace seconds of a text file ====
 +<code>
 +Const ForReading = 1
 +Const ForWriting = 2
 +Dim fs
 +Dim fname
 +Dim HasCert
 +Dim vStartNum 
 +Dim vLength
 +Dim FileIndex 
 +vStartNum = 1
 +vSourcePath = "WorkFlow(GetCustomerFiles).Get(FileName)"
 +vTargetPath = "WorkFlow(GetCustomerFiles).Get(SourcePath)\Working\"
 +Set objfso = CreateObject("Scripting.FileSystemObject")
 +Set objFile = objfso.OpenTextFile(vSourcePath, ForReading)
 +strtext = objFile.ReadAll
 +sSearchString1 = "<customer"
 +sSearchString2 = "</customer>"
 +objFile.Close
 +While InStr(vStartNum, strtext, sSearchString1) > 0
 +    FileIndex = FileIndex + 1
 +    vStartNum = InStr(vStartNum, strtext, sSearchString1)
 +    vLength = InStr(vStartNum, strtext, sSearchString2) - InStr(vStartNum, strtext, sSearchString1) + 11
 +    strNewText = Mid(strtext, vStartNum, vLength)
 +    Set fname = objfso.CreateTextFile(vTargetPath & "WorkFlow(GetCustomerFiles).Get(FileTitleWithoutExtension)" & "_" & FileIndex & ".xml", True)
 +    fname.WriteLine strNewText
 +    fname.Close
 +    vStartNum = InStr(vStartNum, strtext, sSearchString2) + 11
 +Wend
 +</code>
 +
 +====VB Script Variables====
 +
 +^ Name           ^ Description          ^
 +|ScriptCode|The actual VBScript code that is written in the tool|
 +|StepMessage| During a failure the reason for failure will be populated here|
 +|StepStatus| True or False|
bw/vbscript_tool.1590007818.txt.gz · Last modified: 2020/05/20 16:50 by akoehler