LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Dim doc As NotesDocument<br />
Set uidoc = ws.CurrentDocument<br />
Set doc = uidoc.Document<br />
Execute doc.txtScript<br />
Print "Completed Script"<br />
End Sub<br />
Other Interesting <strong>LotusScript</strong> Commands<br />
The Width #filenumber, Width statement <strong>for</strong>ces a set ASCII file width, with<br />
autowrap to the beginning of the next line when the width has been<br />
exceeded.<br />
The YIELD statement is equivalent to doEvents in <strong>Visual</strong> <strong>Basic</strong> 4. And the<br />
Yield statement requires a return value, unlike the doEvents in <strong>Visual</strong> <strong>Basic</strong>,<br />
but equivalent to <strong>Visual</strong> <strong>Basic</strong>’s doEvents function.<br />
The TypeName (strFileName$) statement will return the word “STRING”.<br />
This allows you to determine the datatype of a variable at run time, which<br />
is useful when you have passed variables that may contain any type of data<br />
in them.<br />
<strong>LotusScript</strong> “feels” a little more like C++ than like BASIC sometimes.<br />
Beyond the standard BASIC keywords, <strong>LotusScript</strong> provides <strong>for</strong> additional<br />
syntax such as “Declare”ing a <strong>for</strong>ward reference to a function or<br />
subroutine. This allows you to code and test the sub or function be<strong>for</strong>e it’s<br />
actually included in your main app — something that’s particularly useful<br />
in team development environments. Developers familiar with<br />
Object-Oriented programming will quickly find themselves creating and<br />
instantiating objects using new (constructors), delete (destructors), and<br />
data-hiding features you would expect to see in C++.<br />
On Event Click from call allows you to react to<br />
events happening in other Lotus products. For example, this would allow<br />
you to create a page-turning presentation to use in a Lotus Notes training<br />
application.<br />
Evaluate (Macro, object) allows you to easily call another (Lotus only)<br />
product macro. This allows you to pass a string of numbers to a<br />
spreadsheet to be totaled, etc.<br />
The %Include command gives you the ability to include <strong>LotusScript</strong><br />
variable, constant and API declarations into your code from external ASCII<br />
files. This allows you to sort through all of the various files provided by<br />
18 <strong>LotusScript</strong> <strong>for</strong> <strong>Visual</strong> <strong>Basic</strong> <strong>Programmers</strong>