Useful Notes SmartIcons: Reformat text is my favorite
Daniel Nashed – 29 December 2024 20:59:17
Notes formula are one of the lost arts. I am a big fan and have started to work with Notes at a time where we had no Lotus Script nor Java.
Today formula language is still very powerful. I am using it in many ways including C-API and Lotus script.
There are many @Commands for UI automation available. But there are also Lotus Script UI classes.
The really cool part of formula language is that you can use the commands in SmartIcons.
The following command selects the body text and sets the text to Default Sans Serif with 10pt.
It works for the whole mail including mail replies.
---
@Command([EditGotoField];"Body");
@Command([EditSelectAll]);
@Command([TextSetFontFace];@GetMachineInfo ([EnvVariable];"NAMEDSTYLE1_FACE"));
@Command([TextSetFontSize]; "10");
@Command([EditDeselectAll]);
---
It works for the whole mail including mail replies.
But there are more SmartIcons I use every day...
Remote server console
Notes 5.0 was the first client splitting client, admin and designer.
The old remote console is still available and works also without an admin client installed.
And also works on Mac and Nomad Web by the way.
---
@Command([AdminRemoteConsole])
---
Opening the notes.ini in notepad
This formula combines two commands. @ConfigFile is also useful in any text field with Shift + F9.
---
@Command([Execute];"notepad"; @ConfigFile)
---
Edit a field in a document
Another useful formula allows to update fields. This is one is for text field.
---
FieldName := @Prompt([OkCancelEdit]; "FieldName"; "Type the Field to change"; "") ; FieldValue := @Prompt([OkCancelEdit]; "FieldValue"; "Type the new Value"; "") ; FieldName + " --> " + FieldValue; @SetField (FieldName; FieldValue)
---
- Comments [2]
1Glen Urbna 02.01.2025 8:59:28 Edit field formula
The code below allows the user to select which field to edit. I can't take credit for it. Not sure where it came from (had for years).
REM {Get a listing of all the fields on the current document};
List := @DocFields;
REM {Possible data types to choose from.};
REM {I called Number Integer because use keyboard to select what you want with keyboard quicker.};
DataTypes := "Text" : "Date" : "Integer" : "Password" : "Name" : "Common Name" : "**** Remove Field ****" : "Text Multi Value" : "Date Multi Value" : "Integer Multi Value" : "Name Multi Value";
REM {Prompt for which field needs to be updated.};
EditField := @Prompt([OkCancelList]; "Select Field To Update"; "Select the field you wish to update:"; ""; List : "**** ADD A NEW FIELD ****");
REM {If adding a new field, prompt for the field name};
NewFieldName := @If(EditField = "**** ADD A NEW FIELD ****"; @Prompt([OkCancelEdit]; "Enter Field Name"; "Enter the name of the new field:"; ""); "");
CheckFieldName := @If(@IsMember(NewFieldName; List) & NewFieldName != ""; @Return(@Prompt([Ok]; "Already In List"; "The field " + NewFieldName + " already exists on the document.")); "");
UpdateVariable := @If(NewFieldName = ""; ""; EditField := NewFieldName);
REM {Prompt for which data type you would like the data to be};
REM {This needs to be done before value prompt to determine if the};
REM { Picklist or any prompting needs to be used.};
DataType := @Prompt([OkCancelList] : [NoSort]; "Choose Data Type"; "Please Select the correct data type or action for field: " + EditField; "Text"; DataTypes);
REM {For multi-valued fields, let the user choose the separator to use};
Separator := @If(@Contains(DataType; "Multi Value"); @Prompt([OkCancelList] : [NoSort]; "Choose Separator"; "Choose the separator to split out your multiple values"; ":"; (":" : ";" : "+" : "-" : "*")); "");
REM {Pull out the current value of the field};
CurrValue1 := @Eval(@Text(EditField));
CurrValue2 := @Abstract([TextOnly]; 254; ""; @Text(EditField));
CurrValue := @If(@IsNumber(CurrValue1) | @IsTime(CurrValue1); @Implode(@Text(CurrValue1); Separator); CurrValue2 != ""; CurrValue2; @Implode(@Text(CurrValue1); Separator));
REM {Based on what type of data is being entered different prompts will happen if any at all.};
RawValue := @If(
@Contains(DataType; "Name Multi Value"); @PickList([Name]);
@Contains(DataType; "Name"); @PickList([Name] : [Single]);
DataType = "**** Remove Field ****"; "";
@Contains(DataType; "Multi Value"); @Prompt([OkCancelEdit]; "New Value"; "Please enter the new desired value for: " + EditField + " seperated with " + Separator + " for each value."; CurrValue);
@Prompt([OkCancelEdit]; "New Value"; "Please enter the new desired value for: " + EditField + "."; CurrValue)
);
REM {If data conversion doesn't work then don't set field.};
@If(
DataType = "Date"; @If(@SetField(EditField; @TextToTime(RawValue)));
DataType = "Integer"; @If(@IsError(@TextToNumber(RawValue)); ""; @SetField(EditField; @TextToNumber(RawValue)));
DataType = "Password"; @SetField(EditField; @Password(RawValue));
DataType = "**** Remove Field ****"; @SetField(EditField; @DeleteField);
DataType = "Text Multi Value"; @SetField(EditField; @Explode(RawValue; Separator));
DataType = "Date Multi Value"; @SetField(EditField; @TextToTime(@Explode(RawValue; Separator)));
DataType = "Integer Multi Value"; @If(@IsError(@TextToNumber(@Explode(RawValue; Separator))); ""; @SetField(EditField; @TextToNumber(@Explode(RawValue; Separator))));
DataType = "Name Multi Value"; @SetField(EditField; @Explode(@Name([Canonicalize]; RawValue); Separator));
@SetField(EditField; RawValue)
);
""
2Paul T 09.01.2025 21:38:58 Useful Notes SmartIcons: Reformat text is my favorite
AdminRemoteConsole is wild!