Monday, 10 December 2007

My on Error in LotusScript Agents


ExitNow:


Exit Sub

HandleError:

Dim strNewLineChar As String

Dim atkDb As NotesDatabase
Dim atkSession As New NotesSession()
Dim strErrMessage As String

strNewLineChar = Chr(13) + Chr(10)
If Not atkSession.CurrentAgent Is Nothing Then
strErrMessage = strErrMessage + "While running the agent named ["+_
atkSession.CurrentAgent.Name +"]" + strNewLineChar

strErrMessage = strErrMessage + " under the username ["+_
atkSession.CurrentAgent.OnBehalfOf +"]" + strNewLineChar

strNewLineChar = strNewLineChar + "
"

End If

strErrMessage = strErrMessage + "There has been an error encountered in the database with the title [" + _
atkSession.CurrentDatabase.Title + "]" + strNewLineChar + " on the server [" + _
atkSession.CurrentDatabase.Server + "] at the file location [" +_
atkSession.CurrentDatabase.FilePath + "]" + strNewLineChar

strErrMessage = strErrMessage + "The session username is ["+_
atkSession.username +"]" + strNewLineChar


strErrMessage = strErrMessage + "The error occurred at " + strNewLineChar + _
"Line number "+ Cstr(Erl) + strNewLineChar + _ ' Current line number (in the LS source)
"Function Name " + Lsi_info(2) + strNewLineChar + _ ' The current function or sub
"Module " + Lsi_info(3) + strNewLineChar + _ ' The current module
"Caller function: " + Lsi_info(12) + strNewLineChar +_ ' The name of the function that called this one, "the caller"
"The error code is " + Cstr(Err) + strNewLineChar +_
"The error message is " + Cstr(Error)


Print strErrMessage
Goto ExitNow
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.




NameDescriptionType
Err Numeric error code integer
Error Error text string
GetThreadInfo(LSI_THREAD_LINE) Current line number variant
GetThreadInfo(LSI_THREAD_PROC) Current procedure variant
GetThreadInfo(LSI_THREAD_MODULE) Current module variant*
GetThreadInfo(LSI_THREAD_VERSION) Lotusscript version variant
GetThreadInfo(LSI_THREAD_LANGUAGE) Language setting variant
GetThreadInfo(LSI_THREAD_COUNTRY) Country/Region setting variant
GetThreadInfo(LSI_THREAD_TICKS) Current clock ticks variant
GetThreadInfo(LSI_THREAD_TICKS_PER_SEC) Clock ticks per second variant
GetThreadInfo(LSI_THREAD_PROCESS_ID) Current process ID variant
GetThreadInfo(LSI_THREAD_TASK_ID) Current task ID variant
GetThreadInfo(LSI_THREAD_CALLPROC) Calling procedure variant
GetThreadInfo(LSI_THREAD_CALLMODULE) Calling module variant
Lsi_info(1) Current line number string
Lsi_info(2) Current procedure string
Lsi_info(3) Current module string
Lsi_info(6) Lotusscript version string
Lsi_info(9) Language setting string
Lsi_info(12) Calling procedure string
Lsi_info(50) LS memory allocated string
Lsi_info(51) OS memory allocated string
Lsi_info(52) LS blocks used string

* = this call returns a hex code, not the module name

Note:To use the GetThreadInfo constants, you must include LSPRVAL.LSS, which is automatically included through LSCONST.LSS

Wednesday, 10 October 2007

IBM/Lenovo Laptop Beeps. Very Loud.

IBM/Lenovo Laptop Beeps. Very Loud.

These beeps come from 3 places. Do not try to recreate these wearing headphones as it might hurt your ears.

1. Pressing 3 keys at once
2. Battery related beep
3. Changing volume beep.

All three can be disabled.

1. Press Function and Backspace

2. Modify in the Battery settings
Power Manager, then Global Power Settings tab, and deselect “Beep on power state changes.”

3. Open Thinkpad configuration and disable the beep after selecting audio properties, bottom left. Alternatively, in control panel, find the device manager, show hidden devices, in the Non-plug and play list disable the one named Beep.

Information from here
http://www.lenovoblogs.com/insidethebox/?p=42

Thursday, 30 August 2007

RightBack

Option Compare Text
Function RightBack(strBigString As String, strSmallString As String) As String
' Finds the text after a string
' eg =RightBack( "I love life and other stuff, do you", "," ) returns " do you"

Dim lngIndexOf As Long

lngIndexOf = InStrRev(strBigString, strSmallString)
If lngIndexOf = 0 Then
strRightBack = ""
Else
strRightBack = Mid(strBigString, lngIndexOf + 1)
End If ' we found one instance


RightBack = strRightBack

End Function

Function InStrRev2(strBigString As String, strSmallString As String) As Long
InStrRev2 = InStrRev(strBigString, strSmallString)

End Function
http://www.ozgrid.com/Excel/find-nth.htm