Tip

Programmatically set "User Preferences" options

You can set most user preference options by affecting a change to the "Preferences=" Notes.ini variable. This can be done without going through the Notes UI, that is, programatically. Only trick is what does that number mean? It means the following when converted to a 32 bit binary string (read from right to left):

Bit
0 <0> = Keep workspace in back when maximized (Enabled=1)
1 <2> = Scan for unread
2 <4> = <Unknown?>
3 <8> = Large fonts
4 <16> = <Unknown?>
5 <32> = Make Internet URLs (http//:) into hotspots
6 <64> = <Unknown?>
7 <128> = Typewriter fonts only
8 <256> = Monochrome display
9 <512> = Scandinavian collation
10 <1024> = <Unknown?>
11 <2048> = <see 28>
12 <4096> = Sign sent mail (Enabled(1))
13 <8192> = Encrypt sent mail
14 <16384> = Metric(1)/Imperial(0) measurements
15 <32768> = Numbers last collation
16 <65536> = French casing
17 <131072> = empty trash folder (prompt during db close=0/always during db close=1<plus "EmptyTrash=1" in INI>/manual=1<plus "EmptyTrash=2" in INI>
18 <262144> = Check for new mail every x minutes (Enabled=0)
19 <524288> = Enable local background indexing
20 <1048576> = Encrypt saved mail
21 <2097152> = <Unknown?>
22 <4194304> = <Unknown?>
23 <8388608> = Right double-click closes window
24 <16777216> = Prompt for location
25 <33554432> = <Unknown?>
26 <67108864> = Mark documents read when opened in the preview pane
27 <134217728> = Enable local scheduled agents
28 <268435456> = Save sent mail (Always prompt=10/Don't keep a copy=00/Always keep a copy=01)
29 <536870912> = <see 30>
30 <1073741824> = New mail notification (None=10/Audible=00/Visible=01)
31 <2147483648> = <Unknown? - there is no 31 in 4.6x...>

Table excerpted from a Notes.net posting


Once you know what bits (options) you want to change, you can use LotusScript to make them.

Here is an example of how to alter JUST the "Save Sent Mail" Option (bits 11 & 28) without messing up any other user settings:

Sub Initialize

     Dim s As New NotesSession

     ' Set "Save sent mail" option  to "Always Prompt".  We need mail
server diskspace !!!
     Dim pref As Long
     Dim newpref As Long

     pref=s.GetEnvironmentValue( "Preferences" , True )
     prefbin$=Bin$(pref)  ' convert to a 32 bit binary string

       ' Set the two bit positions for "Save sent mail" option (11 & 28) to
"Always Prompt" (0 & 1)
     Mid$(prefbin$, 4, 1) = "1"     'bit pos 28  (32 minus 28)
     Mid$(prefbin$, 21, 1) = "0"   'bit pos 11 (32 minus 11)

     newpref="&B" & prefbin$ ' convert result back to a Long decimal number
     Call s.SetEnvironmentVar( "Preferences" , Cstr(newpref), True )

End Sub

This was first published in October 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.