360 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Forum | Blogs | Search | myPL | About 
 
Latest 7 Posts
New Media Tuesday - 3/16/2010
Tue, Mar 16th 2010 25
Open XML SDK for Microsoft Office Version 2.0 has shipped
Mon, Mar 15th 2010 88
New Media Tuesday - 3/9/2010
Tue, Mar 9th 2010 38
Iron Maiden Summer 2010 Tour - Supported by Dream Theater
Thu, Mar 4th 2010 45
New Media Tuesday - 3/2/2010
Tue, Mar 2nd 2010 28
Reminder: OpenNTF.org IP Working Group Open Call Tomorrow!
Thu, Feb 25th 2010 62
Welcome to the updated JohnDavidHead.com
Thu, Feb 25th 2010 151
Top 10
Lotusphere 2010 : More Details about Lotus Symphony 3.0
Mon, Feb 1st 2010 172
Time for another review ... IBM Lotus Notes and Domino 8.5.1
Sun, Jan 31st 2010 164
Word of Warning: Don’t Download Symphony 3 Beta just yet
Fri, Jan 29th 2010 151
Welcome to the updated JohnDavidHead.com
Thu, Feb 25th 2010 151
It’s time Microsoft decide how serious they are about real people using OOXML
Tue, Feb 16th 2010 141
IBM Lotus Symphony Website gets a makeover
Wed, Feb 3rd 2010 129
IBM Lotus Symphony 3 Beta 2 is now available
Wed, Feb 3rd 2010 119
9 Years
Fri, Dec 18th 2009 105
Lotusphere 2010 : Lotus Symphony Architecture - Current and Future
Tue, Feb 2nd 2010 92
PSC Getting Started Sample Database for Microsoft Office and Lotus Symphony Integration from Lotusphere 2010
Mon, Feb 8th 2010 90


Lotus Symphony Documents "Hello World" in LotusScript
John Head    

To get started with the Lotus Symphony LotusScript API, let's write our first code sample - the ever popular "Hello World" sample.

To start, create a new button in a Rich Text field in a document. Change the code selection drop-down to "LotusScript" and enter the (Options) section. To begin, every time you want to use the Lotus Symphony LotusScript API, you need to call the LSX. You do that with the following code:

       %INCLUDE "symphonylsx.lss"

This tells LotusScript to load the Symphony LSX. It also enables LotusScript to do cool things like provide type-ahead for the custom LSX - even in buttons or in actions on a form or view.

Image:Lotus Symphony Documents "Hello World" in LotusScript

Now let's write some code. Go into the Click section of the button and enter the following:

       Dim application As SymphonyApplication    
       Set application = New SymphonyApplication

To begin, we are creating an application variable and setting it to the SymphonyApplication class. We then set that variable to a new instance of that class. So how did I know what the object model for the API is? In that Toolkit download that I talked about in my last blog, if you go into the lsxapidoc folder, open the Index.html file. Click the Document API Link.

Image:Lotus Symphony Documents "Hello World" in LotusScript

This gives you a complete roadmap for the Symphony LotusScript API for Documents. You can click on each class to get all of the properties, methods, and description of each class and some samples.

We are starting with SymphonyApplication. Think of this like the NotesSession class. You will call this class no matter which of the three Symphony applications you are using. You will not see anything on screen at this point. Symphony has loaded into memory. Next, we call the SymphonyDocuments class

       Dim documents As SymphonyDocuments
       Set documents = application.Documents  
       
We are defining and setting an instance of a class that defines the Symphony Application type. At this point, you will see Lotus Symphony load on your screen. Next, we set up a single document instance to work with:

       Dim document As SymphonyDocument
       Set document =  documents.AddDocument("",True,True)

Here, we have told Symphony to load a blank new document. The AddDocument method has the following properties:

Set
document = documents.AddDocument(Template, AsTemplate, Visible)

Since we are not using a template, we leave the first parameter blank. And since there is no template, you must set the AsTemplate property to False. The documentation will tell you that you can use True or False here when Template is blank, but trust me - use False. Otherwise you will crash Notes. I know by experience!. We are also setting Visible to true. This will display the blank new document within Lotus Symphony Documents in your Notes client. We then need to setup a range to work with:

       Dim range As SymphonyTextRange
       Set range = document.content.End

If you are not working with a named object, like a bookmark or table cell, you have to work with a range. Since this is a blank document, the easiest range to work with is the entire document. So after defining our range variable, we set the range to the entire document contents using the document.content.End property. There is nothing in the document, so this is really just getting the cursor location, but it will work for our purpose. Last, we enter some text:
       
       Call range.InsertBefore("Hello World")

Using the range.InsertBefore method, we enter our "Hello World" text. Here is the code in a copy and paste format:

%INCLUDE "symphonylsx.lss"

Dim application As SymphonyApplication    
Dim documents As SymphonyDocuments
Dim document As SymphonyDocument
Dim range As SymphonyTextRange
       
Set application = New SymphonyApplication
Set documents = application.Documents  
Set document =  documents.AddDocument("",True,True)
Set range = document.content.End
       
Call range.InsertBefore("Hello World")

Once you exit the button, save the Notes document, change to Edit mode; click the button. You should see this:

Image:Lotus Symphony Documents "Hello World" in LotusScript

You might have noticed that Symphony took a bit to load up. Leave the Symphony Document open and go back to the button. Click it again. You will notice that it is quite a bit faster. Symphony caches after the first load - and also uses a start-up procedure to speed itself up. In preference, you can set if this should load at startup. You can see that option here:

Image:Lotus Symphony Documents "Hello World" in LotusScript

If you click that, you will notice a process called soffice.exe loads at Windows startup. Here is a view of that from Windows Task Manager:

Image:Lotus Symphony Documents "Hello World" in LotusScript

If you disable that, the first time load will be significantly longer than without the startup pre-load. If you use Symphony regularly, I recommend you turn this on.

There you go - your first piece of Lotus Symphony LotusScript API code written!

---------------------
http://www.johndavidhead.com/jhead/johnhead.nsf/dx/lotus-symphony-documents-hello-world-in-lotusscript-
Oct 21, 2009
25 hits



Recent Blog Posts
25


New Media Tuesday - 3/16/2010
Tue, Mar 16th 2010 12:20p   John Head
Here is what's coming out today ... Movies Armored Barnaby Jones: Season #1 Broken Embraces Cannon: Season #2: Volume 2 Clash of the Gods: Season #1 Destination Truth: Season #1 Did You Hear About the Morgans? Dillinger Is Dead: The Criterion Collection Fourth Kind, The Hawaii Five-O: Season #8 In Plain Sight: Season #2 Monk: Season #8 Ninja Assassin One Piece: Season Two: Sixth Voyage Penguins Of Madagascar, The: Operation: DVD Premiere Ponyo Princess And The Frog, The (Blu-Ray + DVD + D [read] Keywords: mac vista
88


Open XML SDK for Microsoft Office Version 2.0 has shipped
Mon, Mar 15th 2010 2:50p   John Head
A big day for the OOXML community ... On February 21, 2008, I posted on Microsoft Interoperability Principles, which are designed to make our products more open and more available to the broader software community. Since that day, Microsoft has made several strides in this area, too many to recount here and now, but largely explained by the Interoperability@Microsoft team. Today we are making an important advance in the area of document format interoperability for Office, as part of our ongoin [read] Keywords: application applications archive community development javascript microsoft office ooxml sharepoint xml
38


New Media Tuesday - 3/9/2010
Tue, Mar 9th 2010 7:20p   John Head
Here is what's coming out today ... Movies Boondock Saints II, The: All Saints Day Breaking Bad: Season #2 Brothers Warner, The Capitalism: A Love Story Greek: Chapter Four Hannah Montana: Miley Says Goodbye? Hunter: Season #1 In Plain Sight: Season #2 Iron King: The Complete Series Johnny Bravo: Season #1 Life with Derek: Season #3 Matt Houston: Season #1 Penguins Of Madagascar, The: Operation: DVD Premiere Pirate Radio Planet 51 Scarecrow And Mrs. King: Season #1 Stoning Of Soraya M., T [read] Keywords: microsoft vista
45


Iron Maiden Summer 2010 Tour - Supported by Dream Theater
Thu, Mar 4th 2010 4:10p   John Head
Summer, specifically July 18th, 2010, can not come soon enough! [read] Keywords:
28


New Media Tuesday - 3/2/2010
Tue, Mar 2nd 2010 1:50p   John Head
Here is what's coming out today ... Movies 2012 (Blu-Ray) (#1 in the DVDPS Top 40) 2012: 2 Disc Edition (Blu-Ray) (#2 in the DVDPS Top 40) Bitch Slap: Unrated Castle In The Sky: SE Clash Of The Titans (Blu-Ray) (#28 in the DVDPS Top 40) Designing Women: Season #3 Gentlemen Broncos Hell's Kitchen: Season #2 Kiki's Delivery Service: SE Matlock: Season #4 Plenty Ponyo (Blu-Ray) (#17 in the DVDPS Top 40) Ponyo SGU: Stargate Universe: Season #1 (Blu-Ray) Where The Wild Things Are (Blu-Ray) (#4 [read] Keywords: atlantic vista wireless
62


Reminder: OpenNTF.org IP Working Group Open Call Tomorrow!
Thu, Feb 25th 2010 4:31p   John Head
The first quarterly call will be tomorrow, Friday, February 26th 2010 at 10 AM Eastern. The agenda is that I will present our goals and top tasks for 2010 and then open the floor to comments and questions to anyone on the call. To access the call in info, go here. [read] Keywords: openntf
151


Welcome to the updated JohnDavidHead.com
Thu, Feb 25th 2010 11:51a   John Head
So as you can see, this site has a new look. Something a bit more current, a bit more polish, and a bit more focus on what I do on a daily basis. The color scheme matches the PSC look, but this is definitely my site. A bit of the 'edge' is gone - notice that the website title is just "John D. Head" not "John D. Head aka Starfish" - and the World of Warcraft image is gone. Not that this site will go super stuffy, but I wanted this site to be more a reflection on how I have changed. I still play g [read] Keywords: domino ibm lotus blogging facebook linkedin microsoft mobile openntf oracle twitter




44


Changes in Content: Going from the rapid fire firehose method to something more structured
Wed, Feb 24th 2010 4:30p   John Head
As my blog site is getting a visual makeover, so is the way in which I want to deliver content. I started this internal review process over the holidays, but it is interesting it came up recently in the Lotus community. So first, this is not a commentary on anything other than my process. So I have noticed that so many people are posting content on their blog in a rapid fire fashion. They turn on the 'firehose' and just put up content. Lots of posts, as often as possible. Much of this comes f [read] Keywords: inotes lotus notes symphony xpages application blogging community microsoft office openntf planetlotus planetlotus.org
59


This blog is getting a facelift over the next 24 hours ...
Wed, Feb 24th 2010 10:20a   John Head
Please pardon any issues as this blog gets a facelift over the next 24 hours. I am excited about the new look and feel and direction for my site. More as the facelift is complete and the bandages come off [read] Keywords:
63


Today is Paczki Day!
Tue, Feb 16th 2010 12:10p   John Head
This time of year, one of my favorite days is Paczki Day. Today is Paczki Day (well, at least in my family tradition - some people celebrate Paczki Thursday), which just happens to be Fat Tuesday or the day before Lent. Paczki (Punch-key) are delicious, jelly filled dough balls covered with server types of sugar or glaze. The idea behind Paczki's is that on Ostatki (Fat Tuesday), Polish bakers make paczki because 40 days of fasting is about to begin and the cooks must use up the ingredients in t [read] Keywords: server wiki




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - FAQ - Mobile Edition