Updating the .ini preferences line with LotusScript

Here is some LotusScript code that will get the preferences line from the Notes.ini file and allow you to set one of the bit values. In the example below, I am setting the value to enable scheduled local agents. For a listing of the bit values that you can set, see this posting:

http://searchdomino.techtarget.com/tip/1,289483,sid4_gci489680,00.html

This code can be placed in a button, agent, etc., allowing you to update user preferences without touching their machine.
Dim session As New NotesSession
Dim currentPref As Long
Dim newPref As Long
Dim x As Long
Dim k As Long

Dim binPref As String
Dim a As String
Dim b As String
Dim number As String
Dim strPref As String

'get value from ini file and convert to string binary value
currentPref = session.GetEnvironmentValue( "Preferences", True )
binPref = Bin$(currentPref)

'We want to set digit 27 to "1". We have to work backwards (left to right) since this is a string.

a = Mid$(binPref, 1, 4)
b = Mid$(binPref, 6, 27)
number = a + "1" + b

'The following lines convert the binary number back to decimal
k = Len(number) ' will only work with 32 or fewer "bits"
For x = k To 1 Step -1 ' work backwards down string
    If Mid$(number, x, 1) = "1" Then
       If k - x > 30 Then ' bit 31 is the sign bit
          newPref = newPref Or -2147483648# ' avoid overflow error
       Else
          newPref = newPref + 2 ^ (k - x)
       End If
    End If
Next x

strPref = Trim(Cstr(newPref))

Call session.SetEnvironmentVar("Preferences", strPref, True)
This was first published in May 2001

Dig deeper on Domino Resources - Part 5

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close