|
Microsoft Windows Script
action allows you to execute Visual Basic Script
(VBScript) and Java Script (JScript).
To learn more about scripts, click
here.
Click the black down arrow next to
Actions and select
MS Windows Script.

Type any action name in the
Action Name box, for example, Script 1.
Select the scripting language from the
Language box. Two languages are
available: JScript and VBScript.
Type your script (operation you want to be automatically
performed with your data) in the Script
window. For your convenience you can insert any of the fields specified in the
Field Extractor. To do this, click the right mouse button on the Script window
and select a necessary field from Insert Fields
menu. Global objects which names correspond to the field names in the Field
Extractor are created. The access to the values of these objects is available
through the Value property.
To test whether you correctly wrote your script, enter your
source data into the Input Variables
window and click Test. The
Output Variables window shows you the
result you will receive after the program finishes its work.
Stop processing rule if
script execution failed - check this option if you want the program to
stop processing the appropriate rule if the execution of the script fails.
Example of VBScript:
We have My Subscribers rule that processes messages with
subscribe requests from our customers. Field Extractor extracts the following
fields from a message: Name, Email, Action, ProgramName, Date.
Let's admit that the customer typed his name from a lowercase
letter. This example of VBScript checks the subscriber's name and converts the
first letter into a capital letter:
function main
Dim Result, PosNum, SpacePos, SubString, TempString
if Name.Value= "" then exit function
Result
= ""
PosNum
= 1
SubString = ""
TempString = Name.Value
SpacePos = Instr(PosNum,Name.Value," ")
while SpacePos > 0
SubString
=
Mid(TempString,1,SpacePos-1)
TempString = Mid(TempString,SpacePos+1,Len(TempString)-SpacePos)
Result = Result & UcaseFirstChar(SubString) & " "
SpacePos = Instr(TempString," ")
wend
Name.Value =
Trim(Result &
UcaseFirstChar(TempString))
end function
function UcaseFirstChar(Value)
UcaseFirstChar = UCase(Left(Value,1)) & Right(Value,Len(Value)-1)
end function
|