Copy text from template into mail (Lotus Notes) - lotus-notes

I'm trying to create a toolbar button that inserts a footer (including some buttons) into the current mail.
As far as I know, theres no way to create and modify buttons directly with Lotus Formula, so I'm trying to copy/paste from another document. I can't use a mail template because I need the text to be inserted in replies.
This is what I have assembled from online examples:
#PostedCommand([FileOpenDatabase]; "SERVER" : "mailbox.nsf" ;
"($All)" ; "" ; 1 ; 1 ) ;
#PostedCommand([OpenDocument] ; "" ; "34884517EED80C33C125A999005301D4") ;
#PostedCommand([EditDocument]) ;
#PostedCommand([EditGotoField] ; "Body" ) ;
#PostedCommand([EditSelectAll]) ;
#PostedCommand([EditCopy]) ;
#PostedCommand([FileCloseWindow]) ;
#PostedCommand([FileCloseWindow]) ;
#PostedCommand([EditPaste])
This works inconsistently, depending on what I am looking at when pressing the button.
Sometimes it opens a search box with the actual text of the mail pasted in it. It does seem to close the new mail.
I'm especially confused because many commands don't take any arguments, eg FileCloseWindow. How do I control the "context" of the commands or check for success?
It feels like doing automation with SendKeys - fire off a chain of commands and hope that nothing unexpected happens. Of course, I am a total noob with Lotus Formula, so I may be doing this totally wrong. Any help is appreciated.

You may want to use Alan Lepofsky's free "Paste Information" application.
The Notes database "Paste Information" serves as the repository for the content you wish to reuse. Move the cursor to the position where you want to insert the text, click on the "Paste Information" Toolbar icon and then choose the document (aka. text) to insert.
http://www.alanlepofsky.net/alepofsky/alanblog.nsf/dx/paste-information-application

There really isn't a good solution for this using formulas. You'll be stuck in the SendKey-like world you describe.
If you can modify the mail template even a little, you could add a form to it that includes your text and buttons, instead of grabbing it from a central database. Then you could automate creating a new document based on that form, copying the contents, etc. That could help the automation work consistently and perhaps more quickly since it would be getting the resource from within its own database.
You could also then add a shared action button to all the mail forms (memo, reply, etc) that runs this formula, which would make distribution a lot easier.
I'm afraid even with LotusScript, this is an impossible task because you can't insert rich text into a UI document ( or at least not in the version I am running ).

Related

Open a specific section within a form

I have 3 sections within a form. Is it possible to open a specific section using Lotus Script?
If the answer is no, then are there any tricks to do that?
No simple way, exists: #formula and LotusScript don't give finer grain than collapse expand all sections.
The only way is to send keys (controlling the keyboard by using DLL as explain by Richard in the bellow remark). You make a goto field to the field (not in the section) before the section and then send the number of "below key" needed to navigate to the section, then send "+" (which expand the section).
You can get creative with the hide when's. Can you be a little more specific about what you're wanting?

Microsoft Word Automated Find and Replace feature

In a Microsoft template file I downloaded from their website, whenever you type any word in place of where it says " < your company > " (for instance, if I type the word "Apple" in it's place), it automatically changes it everywhere within the entire document. So anywhere in the document that says " < your company > ", it will now all be changed to "Apple".
Does anyone know how to create that?
It seems like some pre-programmed and automated "Find & Replace" feature, but I don't know how to create it. Does it involve some external Excel file? I don't think it's a macro, because " < your company > " is replaced by text that is entered, not a pre-determined word.
This video kind of addresses what I'm trying to achieve. But it's not quite perfect because it's talking about a "find and replace" for multiple Word files, and for replacing the text with a pre-determined word (not what the user enters):
www.youtube.com/watch?v=etSoe8P7_PE
The Word file I'm referring to can be downloaded from my dropbox here:
https://www.dropbox.com/sh/b8hg0ahbx27wfij/CdlGP_bdcm
If you don't feel comfortable downloading a file from my dropbox: I downloaded this file from Microsoft's website, so if you want to download it directly from there, you can via the link below. It seems like the link won't take you directly to the file, so you just have to enter "project change" in the search bar and click enter, then download the Word 2013 "Project change authorization form (Business Blue design)" file:
http://office.microsoft.com/en-us/templates/results.aspx?qu=project%20change&queryid=13f05805-9704-404a-911b-c3cd70c3fe5c&avg=zwd#ai:TC103444179|
Thank you so much for your time and help!!
This is the code you look for :
Find and Replace using Word interop
Hope this helps.
The current version of the OP's template lives at https://templates.office.com/en-us/Services-proposal-Business-Blue-design-TM02911896
It is using content controls (forms), which are accessible under the developer tab of the ribbon. Click "Design Mode" to view the magic.

Notes toolbar button to archive selected (email) document

You can archive e-mails immediately by using the menu, Actions > Archive > Archive Selected Documents.
How can I create a toolbar button that I can click which will perform the above action?
I've already created toolbar buttons to move documents to folders so I'm semi-familiar with the process of creating a button entering formula language commands.
Not sure what you're question is, but having a stab at it. So you want to put the logic in the "toolbar" so you can run it on any database right ? You would have to be able to call the agent that does the job. Well, if you're doing this on mail files only, you can actually call the command
#Command([ToolsRunMacro];"Archive\\Archive Selected Documents");
You'll need the double backslash as it's an "escaped" after saving.
But if you're thinking of trying this to work on any database, you're in a bit of trouble.
Toolbars have a pretty sloppy way of looking for agents you want to run. Because, if you attempt to run an agent from the toolbar, the formula in the toolbar button assumes the database of the current view you are looking at, as the database with the agent as well.
This is no better than copying the agent into every other database that you want to run the agent on. That's why the above solution for archive, only works in mail files as the agent should be there in every case.
Otherwise, you are left with the overhead of copying the required agent around everywhere. To prove the point, a simple test. Create a toolbar button with the following formula.
#Prompt([Ok];"Hello Notes..";#Implode(#DbName;#Char(13)));
Now open any database. Note that the prompt actually shows you the details of the currently open database. This is where the toolbar button will look when trying to run that archive agent.
As there is no way to specify in Notes formula command, the database location in the #command([ToolsRunMacro]), we're unable to call a centralised agent to do the job that I think you're postulating.
A good idea, and a worthwhile problem for the vendor to solve, but this is one many things IBM has never addressed since ...way to long ago.
I would recommend tool called SWING PDF Converter.
It add's Lotus Notes toolbar button and can convert any Lotus Notes document to PDF.
It supports single document conversion from view, multiple documents conversion as separate PDF files, PDF package and bookmarks PDF document. You can also export data in XML and CSV format.

Button-Triggered Insert File Only Works If Portal Contains Edit Box for Container Field

I'm working with a FileMaker Pro 11 database that contains a portal. I've added an "attach file" button to the portal which triggers a simple "Insert File[portal_table::attachment_field]" script. When I click on the button, I would expect an insert file dialog box to appear. Instead, nothing happens.
If I add a text box to the portal, setting the text box's field to portal_table::attachment_field, the attach button starts working.
Why am I required to add this text box to the portal in order for my button-triggered script to work? Is there a way I can modify my script so that it works without requiring the text box's presence?
Thank you,
Ben
Generally speaking FileMaker's "Insert..." commands behave as if a user has done an action manually (activating script triggers, selecting the field, etc.) including the requirement that the field actually be displayed on the screen.
Unfortunately, as far as I am aware, there is not a way to use "Set Field" to specify a file to be added to a container field. One possible work-around is the following:
Freeze Window
Set Variable [$RecordIndex to RelatedTable::Index]
Go to Layout [A Layout of RelatedTable specifically for inserting files]
Enter Find Mode
Set Field [Index to $RecordIndex]
Perform Find
Insert File
Go to Layout [Original Layout]
Alternately, it may be easier to just include the field on the layout at a very small size (1 pixel x 1 pixel).

Create Lotus Notes hotkey/shortcut key for "reply to all with history"

Because I like to make common actions quick to access, I'd like to define a hotkey, e.g. Alt+L to do "reply to all with history", to act on the selected email. I'm using Lotus Notes 8.5 under Windows. Currently I have to either click the Reply button and then click "Reply to All with History Only" or I have to press Alt+3 then cursor down several times and press enter. Actually, Alt+3 doesn't always work because if the email is opened in its own window then you have to use Alt+2.
I've pursued several solutions:
o I've looked for consistent hotkeys within Lotus Notes, but no luck. The shortcut key support in Lotus Notes is not very good, and you can't define custom shortcut keys.
o I've tried using AutoHotkey to send keystrokes to Lotus. You can do a reply by typing Alt+A to get to the Actions menu. Unfortunately, the accelerator keys underneath the Actions menu change whether you are in the email list or if the email is in its own window. Also, the Actions menu doesn't always drop down quickly, so timing the sent keystrokes is problematic.
o I've tried writing LotusScript Agents to do a reply all. I've learned there is a Shared Action named "Reply to All\Reply to All with History Only". I don't think there is a way to have an Agent call an existing Shared Action, so I guess I can just clone the Shared Action code into my Agent. That still leaves the problem of invoking the Agent via a hotkey.
o I haven't tried it yet, but I think the solution will be to create an Agent that can perform a reply all. Create a VBS script to use the Lotus Notes OLE/COM interface to invoke the agent then have AutoHotkey call the VBS file when a hotkey is pressed. FYI: AutoHotkey doesn't support COM directly. However AutoIt and I believe AutoHotkey_L do support both COM and hotkeys so I could use one of those languages.
I'm open to any suggestions, but I want a solution that is reliable. As mentioned, my current AutoHotkey solution fails sometimes because the Lotus GUI is not a very standard Windows GUI. As I understand it, the Lotus GUI is a Java/Eclipse application. I believe Lotus supports Eclipse plugins, so maybe that is an option.
I started with:
#IfWinActive Mail - Inbox - IBM Lotus Notes
!l:: Send {Alt}ayr
!r:: Send {Alt}ape
return
But have also included:
#IfWinActive ahk_class SWT_Window0
!l:: Send {Alt}ayr
!r:: Send {Alt}ape
!1::
!S:: Send !1
return
The above is to facilitate usage of the shortcuts even in mails with its own window... where the title text is diff. Hope it helps!
Here are the AutoHotkey shortcuts that I created, which are similar to those mentioned above. I used the hotkeys that I remember from outlook as a basis for them:
IfWinActive, IBM Lotus Notes
{
#IfWinActive New Message
{
^Enter::
SendInput, !1
return
}
#IfWinActive, Inbox
{
^r::
SendInput, !C+E
return
^+r::
SendInput, !A+Y+R
return
}
}
I'm using Notes 8.5, btw.
You might be able to make your life easier with a custom smarticon (toolbar button). I don't have 8.5 to test this on, but it works on Notes 6.
Go into the design view of the mail database, and open up the memo form. Then look for the action button you are trying to duplicate. Copy all the formula code (probably just a few lines). Then create a new toolbar button by right-clicking on a toolbar and choosing Toolbar properties. Paste the formula into the button and save.
This still doesn't get you the shortcut key trigger you're looking for, but perhaps in 8.5 you can assign a hotkey to a toolbar icon? If not, you could create an AutoHotKey script, triggered by a hotkey you choose, that simulates clicking the smarticon button using references relative to the current window. I think it would be consistent provided the toolbar is always in the same place.
Using the helpful "Alt a-y-r" approach above, I just wrote a tiny little AutoHotkey script to map alt+r and alt+l to the common usages:
#IfWinActive Mail - Inbox - IBM Lotus Notes
!l:: Send {Alt}ayr
!r:: Send {Alt}ape
return
Basic, but it works for 90% of my uses. I'm going to create hotkeys for everything using this method.
The obvious way is to press "ALT-A-Y-R" (reply to all with history) or "ALT-A-Y-E" (reply to all with history + attachments).
Pressing ALT-A will show you the hotkeys for each menu option on the Action menu. Might be different character if you are not using the English version.
I found myself here adapting from Outlook's Ctrl+R and Ctrl+Shift+R to reply or reply to all and looking for a way to reply to an email with a sensible number of key presses.
I found that by clicking File > Preferences, there is an option called:
Enable alternate keyboard shortcuts (for example Ctrl+R=Reply)
That solved most of my issue. Using Notes 9.

Resources