Smart Buttons
Controls/XML Elements
                                        String Operation <StringOperation>
StringOperation performs multiple operations on text such as:
- 
                                                Trimming 
- 
                                                Replacing part of the text with different text 
- 
                                                Finding an index of specific elements in the text 
- 
                                                Changing text to upper or lower case 
- 
                                                Finding specific text inside of text with regex. 
Configuring
To configure with the String Operation Editor:
- 
                                                Open the Smart Buttons Editor to create a script.   
- 
                                                Click StringOperation <StringOperation> to display the StringOperation Editor.   
- 
                                                Configure the attributes. Attribute Description String source Enter either: The static text that you want to modify. A variable from your script in square brackets. For example: [EmailAddresses] Variable name Enter the name of the variable that will hold the new modified text (string). For example: UpdatedEmailAddress Operation type Click the Operation type arrow to select operation to perform on the text. - 
                                                                        CharacterCasing Changes text to either lower case or upper case.  More Information More Information  Original text (email addresses from the Booking File):   New text (email addresses in lower case)   
- 
                                                                        StringLength Counts the number of characters within the string. Counts all characters including spaces. 
- 
                                                                        Trim allows to trim (cut) specific text/characters from the beginning of the string, from end or from both  More Information More InformationThe original string (text) is: DI-FT-cost center 84739   The new text after trimming: - cost center 84739   
- 
                                                                        Replace Replaces part of the string with alternative text.  More Information More Information  Original email list with @ (at sign).   New list of email where @ is replaced with //   
- 
                                                                        Substring Cuts part of the text and use it as a new text (substring). 
- 
                                                                        IndexOf Finds the position (Index) of a specific character in the text. If the specified character/s are not found “-1” is returned. 
- 
                                                                        Regex Uses regular expressions to read only a specific part of the text.  More Information More Information  Original text (list of email addresses)   New text, where only domain of the email addresses has been return thanks to regex   
 
- 
                                                                        
Examples
Example 1
To use the following script, be sure to:
- 
                                                Replace the booking number in line 2 with a real booking number. 
- 
                                                Confirm that the Booking File contains at least one email address. 
<ButtonConf ButtonName="Emails - String Operations - all" Description="" QuickCommand="">
<RunCommand>*VT58TD</RunCommand>
<Variable VarName="Emails">%EmailsList%</Variable>
<!--******************-->
<!-- Show the original string (text)-->
<!--******************-->
<ShowMessage>[Emails]</ShowMessage>
<!--******************-->
<!--Change the original text to Lower Case text -->
<!--******************-->
<StringOperation Type="CharacterCasing" VarName="LowerCaseText" Source="[Emails]">
<Arguments>
<Argument Name="Type">ToLowerCase</Argument>
</Arguments>
</StringOperation>
<ShowMessage>[LowerCaseText]</ShowMessage>
<!--******************-->
<!--Show the lenght of my text-->
<!--******************-->
<StringOperation Type="StringLength" VarName="Lenght" Source="[Emails]"></StringOperation>
<ShowMessage>Lenght of the string: [Lenght]</ShowMessage>
<!--******************-->
<!-- Show email addresses where @ is replaced with //-->
<!--******************-->
<StringOperation Type="Replace" VarName="EmailsWithSlashes" Source="[Emails]">
<Arguments>
<Argument Name="ReplaceFrom"><![CDATA[@]]></Argument>
<Argument Name="ReplaceTo"><![CDATA[//]]></Argument>
</Arguments>
</StringOperation>
<ShowMessage>[EmailsWithSlashes]</ShowMessage>
<!--******************-->
<!--Change text to new one, start to read text on 2nd charachter and read 10 charachters-->
<!--******************-->
<StringOperation Type="Substring" VarName="EmailsSubstring" Source="[Emails]">
<Arguments>
<Argument Name="StartFrom">2</Argument>
<Argument Name="Length">10</Argument>
</Arguments>
</StringOperation>
<ShowMessage>Substring, start from 2 and read 10 charachters: [EmailsSubstring]</ShowMessage>
<!--******************-->
<!--Show Index of "@"-->
<!--******************-->
<StringOperation Type="IndexOf" VarName="EmailsIndexOf@" Source="[Emails]">
<Arguments>
<Argument Name="Type">First</Argument>
<Argument Name="SearchString"><![CDATA[@]]></Argument>
</Arguments>
</StringOperation>
<ShowMessage>Index of first "@" : [EmailsIndexOf@]</ShowMessage>
<!--******************-->
<!--Cut only domain of my email addresse with regex-->
<!--******************-->
<StringOperation Type="Regex" VarName="EmailRegexDomain" Source="[Emails]">
<Arguments>
<Argument Name="Pattern"><![CDATA[(?:@)(\w{1,}\.\w{2,})]]></Argument>
<Argument Name="IgnoreCase">True</Argument>
<Argument Name="SingleLineMethod">False</Argument>
<Argument Name="SingleMatch">False</Argument>
<Argument Name="MatchGroups">GroupNumber</Argument>
<Argument Name="GroupNumberValue">1</Argument>
</Arguments>
</StringOperation>
<ShowMessage>[EmailRegexDomain]</ShowMessage>
</ButtonConf>Example 2
The following script checks if the text entered in a text box includes the word “ABC”.
First we check the Index of word “ABC” with StringOperation and then with ConditionalAction we check if the Index is greater that -1 (-1 means no text of “ABC” found in the main string)
<ButtonConf ButtonName="INDEXoF -1" Description="This script allows to check if entered text include word ABC" QuickCommand="OK">
<TextBox VarName="Text" Question="Enter text that you want to check" Width="80"></TextBox>
<StringOperation Type="IndexOf" VarName="NewText" Source="[Text]">
<Arguments>
<Argument Name="Type">First</Argument>
<Argument Name="SearchString"><![CDATA[ABC]]></Argument>
</Arguments>
</StringOperation>
<ConditionalAction Condition="[NewText]>-1">
<True>
<ShowMessage>YES,text that you entered include word "ABC"</ShowMessage>
</True>
<False>
<ShowMessage>NO,text that you entered does not include word "ABC"</ShowMessage>
</False>
</ConditionalAction>
</ButtonConf>
 
                                                                                 
                                                                                