smarticon to create a button to open a new memo using specific stationary

Hello,
I would like to create a smarticon which will create a new message using a specific stationary.
Does anyone know the code/formula to use within this smart icon or where C could go for help on this coding?

Thank You!
Suzanne
LVL 1
AlessoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

patrickabCommented:
Suzanne - Please let us know the application software you are using and in which you would like to create the smart icon - patrickab
0
AlessoAuthor Commented:
Im sorry, it is in Lotus Notes Mail R5
0
patrickabCommented:
Thanks for that Suzanne. I'm afraid I have no experience on it so someone else will need to help.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

patrickabCommented:
If Notes has a script recording facility why not record one to do what you want, save it and then attach it to a macro button. In other Lotus applications that's how it is done. To create a new macro button all you need to do is go into file/iconsetup/editicon/createnewicon and then make your icon, save it after having put a description against it, attach the script to it and that's about it. Oh, I think you may need to add it to the icon bar and save that set of icons so that it appears every time.

Hope that helps
0
CRAKCommented:
I'm afraid that it cannot be done!
Smarticons can only be programmed using @-functions. And none is suitable for this purpose.
Notes does that (under the tools button) in Lotusscript (kind of VB).

The only option is to grab the Lotusscript code, copy it into an agent, modify it where neccessary and launch it from a smarticon, but all depends on wether or not you're allowed to create/run your own lotusscript agents.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlessoAuthor Commented:
It appears that I can create an agent, how do i get the lotusscript code?
0
CRAKCommented:
The original code in the button is:

Sub Click(Source As Button)
     Dim session As New notessession
     Dim uiws As New notesuiworkspace
     Dim collection As notesdocumentcollection
     Dim noteUIEditDocument As notesuidocument
     Dim database As NotesDatabase
     
     Set noteCursorDoc = session.currentdatabase.createdocument
     Set database = session.currentdatabase
     
     Set collection = uiws.Picklistcollection(PICKLIST_CUSTOM, False, database.server, database.filepath, "Stationery", "Select Stationery", "Please select stationery for new memo.")
     Set noteCursorDoc = collection.getfirstdocument
     If Not noteCursorDoc Is Nothing Then
          Set noteUIEditDocument =  uiws.Editdocument(False, noteCursorDoc)
     End If
End Sub

If you copy/paste the everything from the first "Dim" up to End If, you could put that straight into the initialize section of your agent. The agent would then do the exact same thing as the button.

No if you have a stationary called "MyTemplate", and you'd want that one to launch, we need to change some bits. The agent's code would look like this:

Sub Initialize
     Dim session As New notessession
     Dim uiws As New notesuiworkspace
     Dim noteUIEditDocument As notesuidocument
     Dim database As NotesDatabase
     Dim stView As NotesView
     Dim stEntries As NotesViewEntryCollection
     Dim stEntry As NotesViewEntry
     Dim noteCursorDoc As NotesDocument
     Dim Found As Integer
     
     Set noteCursorDoc = session.currentdatabase.createdocument
     Set database = session.currentdatabase
     
     Set stView = database.GetView("Stationery")
     Set stEntries = stView.AllEntries
     Found = False
     Set stEntry = StEntries.GetFirstEntry
     Do While Not (stEntry Is Nothing) And found = False
          If Ucase(stEntry.ColumnValues(5)) = Ucase("myTemplate") Then
               ' Ucase for case insensitive compare, column 5 (view starts at 0) holds stationery name
               Found = True ' stop searching
               Set noteCursorDoc = stEntry.Document
          End If
          Set stEntry = StEntries.GetNextEntry(stEntry)
     Loop
     
     If Not noteCursorDoc Is Nothing Then
          Set noteUIEditDocument =  uiws.Editdocument(False, noteCursorDoc)
     End If
End Sub

Name the agent "Default stationery", make it "run from agents list" and set it to "run once". The code is in Lotusscript (not Formula, Java or whatever other options you have there).

Now the last step....
Pick an empty (macro) smarticon, and assign folowing formula:

@Command([FileOpenDatabase]; @MailDbName);
@Command([ToolsRunMacro]; "(Default stationery)")

It'll first open your mail database (or we won't be able to reach the agent) and then trigger the new agent in it.

Enjoy!
0
AlessoAuthor Commented:
Where do I put the code in the agent? I dont see anywhere it should be, there is the action box but i cant paste anything in it, and there is another box i can type in but when I select "run once" it disappears...
0
CRAKCommented:
That's what I meant... you may not be allowed to create lotusscript agents...

When creating a new agent you see following fields (right hand side, top to botton):
- Name (text, 1 line) + button ("Options")
- Shared agent (checkbox)
- When should this agent run (select "Manually from agents list") + button "Schedule" (may be inactive)
- Which documents should it act on (Select "Run once")
- Then there is an area to refine a search (using the button "Add search...")
Then there is a horizontal line, indicating the end of the frame (you can move it up and down).
In the lower frame you see:
- (in bold) the name of the agent
- Run (select "Lotusscript" and the frame should split horizontally)
- In the (new) left pane, select "Initialize"
- In the right you should enter (copy/paste) the code.
0
CRAKCommented:
Where do you get stuck Alesso?

If creating an agent causes a problem, there may be another way out. Can you look into the design of the folder "($Inbox)"? In the action pane you'll find the definition for the button: "Tools\New Memo - Using Stationery". If you can see the code, you might be able to copy the button and edit it.... Try copy/paste and rename it in the property box. Replace the code with a simple oneliner:

Sub Click(Source As Button)
    Messagebox "Hello world!"
End Sub

If that works, we could create a customised button with the exact function that you want and forget about the smarticon.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.