23. januar 2001 - 11:08
#1
Taget fra Technote EMN3HKCKG i Lotus Notes Knowledge Base
How To Create a SmartIcon To Switch to a Different Language Spell Checker
Problem:
How do you create a SmartIcon to switch to a Spell Checker for a different language?
Solution:
Follow these steps:
1. Create or use two existing SmartIcons that represent two different languages. In this scenario, the desired end result is to create two SmartIcons: one for English, and one for French.
Notes 4.x: Select File, Tools, SmartIcons. Select any two unused icons from the Available Icons list and drag them to the list of icons that are currently being used on the right. If you want to create your own custom SmartIcons, refer to the document, \"Customizing SmartIcons in Notes Using Microsoft Windows\' Paintbrush\" (#111756).
Notes 5.x: Select File, Preferences, SmartIcon Settings. Drag any two unused icons over to the list of icons that are currently being used on the right.
2. Click one of these icons in the right hand list, and select Edit Icon. Add a Description such as ENGLISH and then click the Formula button. In the Formula dialog box, insert the following formula:
@Command([FileSave]);
@Command([ToolsRunMacro];\"English Spell Check\");
@PostedCommand([ToolsSpellCheck])
3. Click OK, then Done, then OK to close all dialog boxes. Repeat this procedure to create a SmartIcon for any other language you desire. In this example, repeat the procedure once to create a second icon for the French Spell Checker. Be sure to change the name of the Agent in the second line of your formula to \"French Spell Check\". Also, be careful to start the last line with @PostedCommand. This is to retain execution order.
@Command([FileSave]);
@Command([ToolsRunMacro];\"French Spell Check\");
@PostedCommand([ToolsSpellCheck])
4. Select your mail file and select View, Agents. (In Notes R5, performing this step will launch Domino R5 Designer if it is installed on your computer.)
5. Select Create, Agent.
6. Call the agent \"English Spell Check\" or whatever you called it in Step 2. This agent should run \"Manually from Actions Menu\" and in the drop down box entitled \"Which documents should it act on?\", be sure to select \"Run Once @Commands may be used\".
7. Choose LotusScript for the radio button choice of \"What should this agent run?\".
8. For Notes 4.x users, in the Event drop down box, select Initialize. Input the following LotusScript code:
Dim sess As New NotesSession
sess.SetEnvironmentVar \"SPELL_LANG\", 1, True
This will set the spelling language to American English.
Create a second agent called \"French Spell Check\" and input the following LotusScript code:
Dim sess As New NotesSession
sess.SetEnvironmentVar \"SPELL_LANG\", 3, True
This will set the spelling language to French Standard. Any language can be used by simply manually selecting the desired language under File, Tools, User Preferences, and making note of the number assigned to the SPELL_LANG variable in the Notes.ini. Whatever this number becomes, substitute that number for the number 3 in the above script.
For Notes 5.x users, you will be able to add an agent only if you have the R5 Designer Client installed. If you do, after you select View, Agents, select \'New Agent\'. Make the same selections as the 4.x user, and then select LotusScript. Click on Initialize, and type in:
Dim sess As New NotesSession
sess.SetEnvironmentVar \"SPELL_LANG\", 1033, True
sess.SetEnvironmentVar \"Preference_en\",\",,,1033,,,,,,\", True
This will set the spelling language to English - United States. Any language can be used, but the settings are different than 4.x. Notes 5.x uses the IBM Spell Checker, and the language numbers do not correspond to the same language numbers in 4.x. Once again, any language can be used, but you must take note of both the SPELL_LANG Notes.ini parameter, and the PREFERENCE_EN parameter. The number will be the same for both variables.
Create a second agent called \"French Spell Check\" and input the following code:
Dim sess As New NotesSession
sess.SetEnvironmentVar \"SPELL_LANG\", 1036, True
sess.SetEnvironmentVar \"Preference_en\",\",,,1036,,,,,,\", True
This will set the spelling language to French Standard.
9. Save the script, and open a mail message. Type in a few words and test your script by clicking on either SmartIcon. The Spell Checker will always run in the language specified by the SmartIcon.
Note: This is a database agent, and hence will run in whatever database it is copied into. It will not run in a database that does not contain the two agents called by the @Command([ToolsRunMacro]) command. If you attempt to do so, you will see an error message informing you that the agent does not exist, and the spell checker will run in whatever language was last chosen.