Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 946
  • Last Modified:

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
0
Alesso
Asked:
Alesso
  • 4
  • 3
  • 3
1 Solution
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now