This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
bw2:vbscript_tool [2020/12/15 11:48] akoehler created |
bw2:vbscript_tool [2024/09/24 16:18] (current) dlee [Introduction (VBScript)] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== VBScript |
| The VBScript tool is used to create “programming” statements in a Bizweaver workflow using the VBScript language. The results from a VBScript step can be used as variables in subsequent workflow steps. | The VBScript tool is used to create “programming” statements in a Bizweaver workflow using the VBScript language. The results from a VBScript step can be used as variables in subsequent workflow steps. | ||
| - | VBScript can be used for a broad range of purposes. Several VBScript samples are included in **//[[bw: | + | VBScript can be used for a broad range of purposes. Several VBScript samples are included in **//[[bw2: |
| There are two key elements to the VBScript tool setup. First is the **VBScript statement**. This is the “program code” that gets executed. | There are two key elements to the VBScript tool setup. First is the **VBScript statement**. This is the “program code” that gets executed. | ||
| Line 12: | Line 12: | ||
| where “VariableName” is the variable that will be displayed for selection (using the < | where “VariableName” is the variable that will be displayed for selection (using the < | ||
| - | |||
| - | In the example below, DataCalc is the value being “calculated” by the script. This value is then placed in a Bizweaver variable named “TimeStamp.” | ||
| A single VBScript step can contain multiple VBScript statements. There must be a “Return” statement for each VBScript statement. | A single VBScript step can contain multiple VBScript statements. There must be a “Return” statement for each VBScript statement. | ||
| - | {{ :bw:vbimage1.png? | + | {{ :bw2:bizweavervbs1.png |}} |
| - Enter the Script text. | - Enter the Script text. | ||
| - | - See **//[[bw: | + | - See **//[[bw2: |
| - | - Click the [**Run**] button to validate your script. | + | - Click the [**Execute**] button to validate your script. |
| - If the Return statements are not included the VBScript may execute normally but the validation will not present any results. | - If the Return statements are not included the VBScript may execute normally but the validation will not present any results. | ||
| - | - Using the [Run] validation will let you see exactly what value will be produced. | + | - Using the [Execute] validation will let you see exactly what value will be produced. |
| - | - The [Run] option may not function as expected if variables from other workflow steps are used in the VBScript. In this case, you will need to use the workflow “Test Run” (Debug) option to step through the workflow. | + | - The [Execute] option may not function as expected if variables from other workflow steps are used in the VBScript. In this case, you will need to use the workflow “Test Run” (Debug) option to step through the workflow. |
| <WRAP center round info> | <WRAP center round info> | ||
| Line 518: | Line 516: | ||
| END IF | END IF | ||
| </ | </ | ||
| + | |||
| + | ==== Find and Replace seconds of a text file ==== | ||
| + | < | ||
| + | Const ForReading = 1 | ||
| + | Const ForWriting = 2 | ||
| + | Dim fs | ||
| + | Dim fname | ||
| + | Dim HasCert | ||
| + | Dim vStartNum | ||
| + | Dim vLength | ||
| + | Dim FileIndex | ||
| + | vStartNum = 1 | ||
| + | vSourcePath = " | ||
| + | vTargetPath = " | ||
| + | Set objfso = CreateObject(" | ||
| + | Set objFile = objfso.OpenTextFile(vSourcePath, | ||
| + | strtext = objFile.ReadAll | ||
| + | sSearchString1 = "< | ||
| + | sSearchString2 = "</ | ||
| + | objFile.Close | ||
| + | While InStr(vStartNum, | ||
| + | FileIndex = FileIndex + 1 | ||
| + | vStartNum = InStr(vStartNum, | ||
| + | vLength = InStr(vStartNum, | ||
| + | strNewText = Mid(strtext, | ||
| + | Set fname = objfso.CreateTextFile(vTargetPath & " | ||
| + | fname.WriteLine strNewText | ||
| + | fname.Close | ||
| + | vStartNum = InStr(vStartNum, | ||
| + | Wend | ||
| + | </ | ||
| + | |||
| + | ====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| | ||
| + | |||
| + | ---- | ||
| + | **[[bizweaver: | ||