Friday, 30 May 2008

PromptForViewName

Function PromptForViewName( ) As String

Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewsArray As Variant
Dim intSize As Integer
Dim i As Integer
Dim strViewName As String
Dim strDefaultName As String
Dim ws As New NotesUIWorkspace()

Set db = session.CurrentDatabase
viewsArray = db.Views

intSize = Ubound(viewsArray)
Redim strViewNamesArr(intSize) As String

Forall v In viewsArray
strViewNamesArr(i) = v.Name
If v.Name = "Contacts" Then
strDefaultName = "Contacts" ' if there is a contacts view, we will default to that
End If
i = i + 1

End Forall

'############################################
' Prompt for view name... default to contact if we have it
'############################################
If strDefaultName = "" Then
strDefaultName = strViewNamesArr(0)
End If

strViewName = ws.Prompt (PROMPT_OKCANCELLIST, _
"Select a View", _
"Select a view to use - (should have first column sorted.)", _
strDefaultName, strViewNamesArr)

If Isempty (strViewName) Then
strViewName = ""
End If

PromptForViewName = strViewName

End Function

Thursday, 22 May 2008

function MakeSafeForURL js

function MakeSafeForURL(strText) {
//eg given it's great+,
// returns it%20 great%2B
//return encodeURIComponent(strText);

strText = strText.replace(/'/g, "");
strText = strText.replace(/"/g, "");
strText = strText.replace(/\+/g, "");
strText = strText.replace(/&/g, "");
strText = strText.replace(/%/g, "");

return strText
}

Tuesday, 20 May 2008

Function



Function GetDbInfoFromReplicaID( strReplicaId As String, strServer As String )

Dim db As New NotesDatabase("","")
Dim blOpened As Boolean

blOpened = db.OpenByReplicaID( strServer, strReplicaId )
If blOpened = False Then
Error 1000, "The database is not found to open by replica id ("+ strReplicaID+") to get the information on the server ("+ strServer +")"
End If

GetDbInfoFromReplicaID = db.Title + "|" + db.FilePath + "|" + db.Server

End Function


Monday, 19 May 2008

Notes Designer Not Installed - maybe it is




A neat trick. If designer is not installed, but Lotus Notes is, try this trick. Create a text file in the notes directory. Call it designer.exe. Launch the notes client and you will see the desinger icon in the bookmarks bar.






( via Simon's Notes : Domino
Designer Not Installed? No Problem :-)


Wednesday, 9 April 2008

Various flags eg from folders


various flags below (from the C API stdnames.h file) with the appropriate line bolded.





/* Please keep these flags in alphabetic order (based on the flag itself) so that

we can easily tell which flags to use next. Note that some of these flags apply

to a particular NOTE_CLASS; others apply to all design elements. The comments

indicate which is which. In theory, flags that apply to two different NOTE_CLASSes

could overlap, but for now, try to make each flag unique. */



#define DESIGN_FLAG_ADD 'A' /* FORM: Indicates that a subform is in the add subform list */

#define DESIGN_FLAG_ANTIFOLDER 'a' /* VIEW: Indicates that a view is an antifolder view */

#define DESIGN_FLAG_BACKGROUND_FILTER 'B' /* FILTER: Indicates FILTER_TYPE_BACKGROUND is asserted */

#define DESIGN_FLAG_INITBYDESIGNONLY 'b' /* VIEW: Indicates view can be initially built only by designer and above */

#define DESIGN_FLAG_NO_COMPOSE 'C' /* FORM: Indicates a form that is used only for */

/* query by form (not on compose menu). */

#define DESIGN_FLAG_CALENDAR_VIEW 'c' /* VIEW: Indicates a form is a calendar style view. */

#define DESIGN_FLAG_NO_QUERY 'D' /* FORM: Indicates a form that should not be used in query by form */

#define DESIGN_FLAG_DEFAULT_DESIGN 'd' /* ALL: Indicates the default design note for it's class (used for VIEW) */

#define DESIGN_FLAG_MAIL_FILTER 'E' /* FILTER: Indicates FILTER_TYPE_MAIL is asserted */

#define DESIGN_FLAG_PUBLICANTIFOLDER 'e' /* VIEW: Indicates that a view is a public antifolder view */

#define DESIGN_FLAG_FOLDER_VIEW 'F' /* VIEW: This is a V4 folder view. */

#define DESIGN_FLAG_V4AGENT 'f' /* FILTER: This is a V4 agent */

#define DESIGN_FLAG_VIEWMAP 'G' /* VIEW: This is ViewMap/GraphicView/Navigator */

#define DESIGN_FLAG_FILE 'g' /* FORM: file design element */

#define DESIGN_FLAG_OTHER_DLG 'H' /* ALL: Indicates a form that is placed in Other... dialog */

#define DESIGN_FLAG_JAVASCRIPT_LIBRARY 'h' /* Javascript library. */

#define DESIGN_FLAG_V4PASTE_AGENT 'I' /* FILTER: This is a V4 paste agent */

#define DESIGN_FLAG_IMAGE_RESOURCE 'i' /* FORM: Note is a shared image resource */

#define DESIGN_FLAG_JAVA_AGENT 'J' /* FILTER: If its Java */

#define DESIGN_FLAG_JAVA_AGENT_WITH_SOURCE 'j' /* FILTER: If it is a java agent with java source code. */

#define DESIGN_FLAG_MOBILE_DIGEST 'K' /* to keep mobile digests out of form lists */

#define DESIGN_FLAG_CONNECTION_RESOURCE 'k' /* Data Connection Resource (DCR) for 3rd party database */

#define DESIGN_FLAG_LOTUSSCRIPT_AGENT 'L' /* FILTER: If its LOTUSSCRIPT */

#define DESIGN_FLAG_DELETED_DOCS 'l' /* VIEW: Indicates that a view is a deleted documents view */

#define DESIGN_FLAG_QUERY_MACRO_FILTER 'M' /* FILTER: Stored FT query AND macro */

#define DESIGN_FLAG_SITEMAP 'm' /* FILTER: This is a site(m)ap. */

#define DESIGN_FLAG_NEW 'N' /* FORM: Indicates that a subform is listed when making a new form.*/

#define DESIGN_FLAG_HIDE_FROM_NOTES 'n' /* ALL: notes stamped with this flag

will be hidden from Notes clients

We need a separate value here

because it is possible to be

hidden from V4 AND to be hidden

from Notes, and clearing one

should not clear the other */

#define DESIGN_FLAG_QUERY_V4_OBJECT 'O' /* FILTER: Indicates V4 search bar query object - used in addition to 'Q' */

#define DESIGN_FLAG_PRIVATE_STOREDESK 'o' /* VIEW: If Private_1stUse, store the private view in desktop */

#define DESIGN_FLAG_PRESERVE 'P' /* ALL: related to data dictionary */

#define DESIGN_FLAG_PRIVATE_1STUSE 'p' /* VIEW: This is a private copy of a private on first use view. */

#define DESIGN_FLAG_QUERY_FILTER 'Q' /* FILTER: Indicates full text query ONLY, no filter macro */

#define DESIGN_FLAG_AGENT_SHOWINSEARCH 'q' /* FILTER: Search part of this agent should be shown in search bar */

#define DESIGN_FLAG_REPLACE_SPECIAL 'R' /* SPECIAL: this flag is the opposite of DESIGN_FLAG_PRESERVE, used

only for the 'About' and 'Using' notes + the icon bitmap in the icon note */

#define DESIGN_FLAG_PROPAGATE_NOCHANGE 'r' /* DESIGN: this flag is used to propagate the prohibition of design change */

#define DESIGN_FLAG_V4BACKGROUND_MACRO 'S' /* FILTER: This is a V4 background agent */

#define DESIGN_FLAG_SCRIPTLIB 's' /* FILTER: A database global script library note */

#define DESIGN_FLAG_VIEW_CATEGORIZED 'T' /* VIEW: Indicates a view that is categorized on the categories field */

#define DESIGN_FLAG_DATABASESCRIPT 't' /* FILTER: A database script note */

#define DESIGN_FLAG_SUBFORM 'U' /* FORM: Indicates that a form is a subform.*/

#define DESIGN_FLAG_AGENT_RUNASWEBUSER 'u' /* FILTER: Indicates agent should run as effective user on web */

#define DESIGN_FLAG_AGENT_RUNASINVOKER 'u' /* FILTER: Indicates agent should run as invoker (generalize the

web user notion, reuse the flag */

#define DESIGN_FLAG_PRIVATE_IN_DB 'V' /* ALL: This is a private element stored in the database */

#define DESIGN_FLAG_IMAGE_WELL 'v' /* FORM: Used with 'i' to indicate the image is an image well.

Used for images with images across, not images down.

'v' looks like a bucket */

#define DESIGN_FLAG_WEBPAGE 'W' /* FORM: Note is a WEBPAGE */

#define DESIGN_FLAG_HIDE_FROM_WEB 'w' /* ALL: notes stamped with this flag

will be hidden from WEB clients */

/* WARNING: A formula that build Design Collecion relies on the fact that Agent Data's

$Flags is the only Desing Collection element whose $Flags="X" */

#define DESIGN_FLAG_V4AGENT_DATA 'X' /* FILTER: This is a V4 agent data note */

#define DESIGN_FLAG_SUBFORM_NORENDER 'x' /* SUBFORM: indicates whether

we should render a subform in

the parent form */

#define DESIGN_FLAG_NO_MENU 'Y' /* ALL: Indicates that folder/view/etc. should be hidden from menu. */

#define DESIGN_FLAG_SACTIONS 'y' /* Shared actions note */

#define DESIGN_FLAG_MULTILINGUAL_PRESERVE_HIDDEN 'Z' /* ALL: Used to indicate design element was hidden */

/* before the 'Notes Global Designer' modified it. */

/* (used with the "!" flag) */

#define DESIGN_FLAG_SERVLET 'z' /* FILTER: this is a servlet, not an agent! */

#define DESIGN_FLAG_FRAMESET '#' /* FORM: Indicates that this is a frameset note */

#define DESIGN_FLAG_MULTILINGUAL_ELEMENT '!'/* ALL: Indicates this design element supports the */

/* 'Notes Global Designer' multilingual addin */

#define DESIGN_FLAG_JAVA_RESOURCE '@' /* FORM: Note is a shared Java resource */

#define DESIGN_FLAG_STYLESHEET_RESOURCE '=' /* Style Sheet Resource (SSR) */



#define DESIGN_FLAG_HIDE_FROM_MOBILE '1' /* hide this element from mobile clients */



#define DESIGN_FLAG_HIDE_FROM_V3 '3' /* ALL: notes stamped with this flag

will be hidden from V3 client */

#define DESIGN_FLAG_HIDE_FROM_V4 '4' /* ALL: notes stamped with this flag

will be hidden from V4 client */

#define DESIGN_FLAG_HIDE_FROM_V5 '5' /* FILTER: 'Q5'= hide from V4.5 search list */

/* ALL OTHER: notes stamped with this flag

will be hidden from V5 client */

#define DESIGN_FLAG_HIDE_FROM_V6 '6' /* ALL: notes stamped with this flag

will be hidden from V6 client */

#define DESIGN_FLAG_HIDE_FROM_V7 '7' /* ALL: notes stamped with this flag

will be hidden from V7 client */

#define DESIGN_FLAG_HIDE_FROM_V8 '8' /* ALL: notes stamped with this flag

will be hidden from V8 client */

#define DESIGN_FLAG_HIDE_FROM_V9 '9' /* ALL: notes stamped with this flag

will be hidden from V9 client */

#define DESIGN_FLAG_MUTILINGUAL_HIDE '0' /* ALL: notes stamped with this flag

will be hidden from the client

usage is for different language

versions of the design list to be

hidden completely */



#define DESIGN_FLAG_WEBHYBRIDDB '%' /* shimmer design docs */



#define DESIGN_FLAG_READONLY '&' /* for files, at least for starters */

#define DESIGN_FLAG_NEEDSREFRESH '$' /* for files, at least for now */

#define DESIGN_FLAG_HTMLFILE '>' /* this design element is an html file */

#define DESIGN_FLAG_JSP '<' /* this design element is a jsp */

#define DESIGN_FLAG_DIRECTORY '/' /* this file element is a directory */



#define DESIGN_FLAG_PRINTFORM '?' /* FORM - used for printing. */

#define DESIGN_FLAG_HIDEFROMDESIGNLIST '~' /* keep this thing out of a design list */



/* These are the flags that help determine the type of a design element.

These flags are used to sub-class the note classes, and cannot be

changed once they are created (for example, there is no way to change

a form into a subform). */



#define DESIGN_FLAGS_SUBCLASS "UW#yi@GFXstmzk=Kg%"



/* These are the flags that can be used to distinguish between two

design elements that have the same class, subclass (see DESIGN_FLAGS_SUBCLASS),

and name. */



#define DESIGN_FLAGS_DISTINGUISH "nw13456789"

Thursday, 6 March 2008

PrependToArray lotusscript

Sub PrependToArray( vArray As Variant, vNewValue As Variant )
' eg ... given vArray = 1,2,3,4
' vNewValue = 99
' returns 99,1,2,3,4
' The is returned in the vArray itself

%REM
' Sample call - Copy this bit to the initialize sub ========================
Dim strPreopleNamesArr(0 To 1) As String ' NOTE THAT Dim will not work, you will get an error Illegal REDIM of fixed array
strPreopleNamesArr(0) = "Mary" ' use REDIM and it works fine
strPreopleNamesArr(1) = "Jane"

Call PrependToArray( strPreopleNamesArr, "John" ) ' put the new value at the start
Print Join(strPreopleNamesArr, ", ")
' End Sample call - End of copy to initialize ===== =========================
%ENDREM

' Move all the values by 1 then add the new value at the front
Dim intIndex As Integer
Redim Preserve vArray(Ubound(vArray)+1)

For intIndex = Ubound(vArray) To 1 Step -1
vArray(intIndex)=vArray(intIndex-1)
Next
vArray(0) = vNewValue

End Sub

Tuesday, 12 February 2008

Lotus Notes View - All By Date Cat for Mail



<?xml
version="1.0" encoding="utf-8" ?>

<!DOCTYPE view
(View Source for full doctype...)>


- <view name="ATK Mail
All By Date Cat" xmlns="http://www.lotus.com/dxl" version="7.0"
maintenanceversion="2.0" replicaid="802573540034959E"
showinmenu="false" noreplace="true" publicaccess="false"
designerversion="7" unreadmarks="none" onopengoto="lastopened"
onrefresh="displayindicator" headers="simple"
opencollapsed="false" showresponsehierarchy="false"
showmargin="true" shrinkrows="false" extendlastcolumn="false"
unreadcolor="black" rowlinecount="1" headerlinecount="1"
rowspacing="1" bgcolor="white" totalscolor="black"
headerbgcolor="#c0e1ff" boldunreadrows="false"
evaluateactions="false" allownewdocuments="false"
allowcustomizations="true" hidemarginborder="false"
marginwidth="0px" marginbgcolor="white" uniquekeys="false"
useapplet="false" treatashtml="false" default="false"
private="false" defaultdesign="false" allowdocselection="false"
colorizeicons="false" direction="lefttoright"
indexrefresh="autofirstuse" indexdiscard="inactive45days"
noviewformat="false" type="standard">



- <noteinfo noteid="1de" unid="5EB72AE1874C0355802573ED003DC594" sequence="3">



- <created>



<datetime dst="false">20080212T111442,76+00</datetime>

</created>


- <modified>



<datetime dst="false">20080212T111520,32+00</datetime>

</modified>


- <revised>



<datetime dst="false">20080212T111520,31+00</datetime>

</revised>


- <lastaccessed>



<datetime dst="false">20080212T111543,66+00</datetime>

</lastaccessed>


- <addedtofile>



<datetime dst="false">20080212T111442,81+00</datetime>

</addedtofile>

</noteinfo>


- <updatedby>



<name>CN=Anthony Kendrick/OU=UK/OU=GTS/O=PwC</name>

</updatedby>


- <wassignedby>



<name>CN=Anthony Kendrick/OU=UK/OU=GTS/O=PwC</name>

</wassignedby>


- <code event="selection">



<formula>@IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 &
Form != "Group" & Form != "Person"</formula>

</code>


- <column itemname="$Sender1"
width="14.3750" resizable="true" separatemultiplevalues="false"
sortnoaccent="false" sortnocase="true"
showaslinks="false" showascolor="true" userdefinable="true"
profiledocname="ColorProfile" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="ColorColumn(Hidden)"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
time="hourminutesecond" zone="never"
dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="fourdigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
fourdigityearfor21stcentury="false" omitthisyear="false"
timeformat24="false" />


<numberformat format="fixed" digits="0" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@UserName</formula>

</code>

</column>


- <column sort="descending"
resort="descending" listseparator="comma" itemname="$116"
width="1"
resizable="true" separatemultiplevalues="true" sortnoaccent="true"
sortnocase="true" flatinr5="false" showaslinks="false"
categorized="true" twisties="true" align="left"
showasicons="false" responsesonly="false" hidden="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>dtDate:=@Date(@If(DeliveredDate != ""; DeliveredDate; PostedDate != "";
PostedDate; @Created)); strMonth := @Text(@Month(dtDate)); strMonth :=
@If(@Length(strMonth)=1; "0" + strMonth; strMonth); @Text(@Year(dtDate)) + " " +
strMonth</formula>

</code>

</column>


- <column sort="descending"
resort="descending" listseparator="comma" itemname="$115"
width="1"
resizable="true" separatemultiplevalues="true" sortnoaccent="true"
sortnocase="true" flatinr5="false" showaslinks="false"
categorized="true" twisties="true" align="left"
showasicons="false" responsesonly="false" hidden="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@Date(@If(DeliveredDate != ""; DeliveredDate; PostedDate != "";
PostedDate; @Created))</formula>

</code>

</column>


- <column align="center"
resort="ascending" resort2="descending" resort2column="14"
itemname="$109" width="1.5000" resizable="true"
separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" hidecolumntitle="true"
hideinr5="true" hidden="true" showasicons="true"
responsesonly="false" twisties="false"
categorized="false" showascolor="false" userdefinable="false"
readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" />

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
fourdigityearfor21stcentury="true" time="hourminutesecond"
zone="never" dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="fourdigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


- <code event="value">



<formula>REM {DNT}; nFollowUpSet :=
@If(@IsAvailable(FollowUpStatus);@TextToNumber(FollowUpStatus);
!@IsAvailable(FollowUpStatus) & @IsAvailable(FollowUpDate) &
FollowUpDate != ""; 2; 0); nPriority := @Text(nfollowupset);
@If(@IsError(nFollowUpSet); ""; nFollowUpSet = 0; ""; nFollowUpSet = 1; 181;
nFollowUpSet = 2; 182; nFollowUpSet = 3; 183; "")</formula>

</code>


- <code event="hidewhen">



<formula>REM { Test if this is version 6.1 of Notes and 6.1 of the template};
OkToShow := @If(@Version < @Text(192); 0; @HasFeature("650Lic"); 1; 0);
OkToShow != 1 | @IsError(OkToShow)</formula>

</code>

</column>


- <column align="center"
listseparator="comma" itemname="$93"
width="3"
resizable="false" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" showasicons="true"
responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="true" parens="false" percent="true" />


- <code event="value">



<formula>REM {This icon formula is used in ($Inbox) folder, (MailThreads) view,
and ($All) view}; CSisPrivate := @If(@IsUnavailable($PublicAccess) &
@IsAvailable($CSVersion);"1";"0"); isImportant := @If(Importance="1";"1";"0");
ViewIcon2 := @If(_ViewIcon = 158 & AppointmentType != "1" & BookFreeTime
= "1"; 12; _ViewIcon); tmpIcon := @If(ExpireDate !="" ;64;displaycopyto_icon =
"1";"sentto.gif"; @If(DeliveredDate = ""; @If(PostedDate="" |
@IsUnavailable(PostedDate); @If(@IsAvailable(IsMailStationery); 21;
@IsAvailable(_ViewIcon); ViewIcon2; 58); @If(IsImportant="1"; 124; 122));
@IsAvailable(_ViewIcon); ViewIcon2; $TypeIcon)); REM; "If the Task has no icon,
display the invitation icon - backward compatibility"; varTaskIcon := @If(Form =
"Task" & (!@IsAvailable(_ViewIcon) | ViewIcon2 = "") &
(!@IsAvailable(_ViewIcon2) | ViewIcon2 = ""); @False; @True); iconOne :=
@If(!varTaskIcon; 133; @If(tmpIcon = ""; 0; tmpIcon)); iconTwo :=
@If(iconOne=124;0;CSisPrivate="1"; 164; isImportant="1"; 150; 0);
iconOne:iconTwo</formula>

</code>

</column>


- <column itemname="$114"
width="2"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" showasicons="true"
align="left" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt"
style="bold" />

</columnheader>


- <code event="value">



<formula>@If(FiledToDMS="1";2;0)</formula>

</code>

</column>


- <column itemname="SametimeInfo"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader title="SametimeInfo"
align="left" readingorder="lefttoright">



<font size="9pt" />

</columnheader>


- <code event="value">



<formula>SentBy := @If(Principal = ""; From; Principal); Attendees :=
@Trim(RequiredAttendees : OptionalAttendees); Who := @If(DeliveredDate != "";
SentBy; @Elements(Attendees) > 0; @Subset(Attendees; 1); SendTo = ""; SentBy;
@Subset(SendTo; 1)); CN1 := @Trim(@Name([Abbreviate]; Who)); CN :=
@If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G := @If(CN
= ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S]; Who));
""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report";
"Mail Router"; Person2)</formula>

</code>

</column>


- <column resort="ascending"
resort2="descending" resort2column="14"
listseparator="comma" itemname="$102"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" align="left"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Who"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


<columnnamesformat showonline="true" columncontainsname="true"
columnname="SametimeInfo" verticalorientation="top" />


- <code event="value">



<formula>SentBy := @If(Principal = ""; From; Principal); Attendees :=
@Trim(RequiredAttendees : OptionalAttendees); Who := @If(DeliveredDate != "";
SentBy; @Elements(Attendees) > 0; @Subset(Attendees; 1); SendTo = ""; SentBy;
@Subset(SendTo; 1)); CN1 := @Trim(@Name([CN]; Who)); CN :=
@If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G := @If(CN
= ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S]; Who));
""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report" ;
"Mail Router"; Person2)</formula>

</code>


- <code event="hidewhen">



<formula>TemplateLang := "en"; @If(@ClientType = "Notes";
@LocationGetInfo([NamePreference]) = "1"; @False)</formula>

</code>

</column>


- <column resort="ascending"
resort2="descending" resort2column="14"
listseparator="comma" itemname="$107"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" hideinr5="true"
hidden="true" align="left" showasicons="false"
responsesonly="false" twisties="false"
categorized="false" showascolor="false" userdefinable="false"
hidecolumntitle="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Who"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


<columnnamesformat showonline="true" columncontainsname="true"
columnname="SametimeInfo" verticalorientation="top" />


- <code event="value">



<formula>REM {This column is an alternative column for alternate names}; REM
{The variable TemplateLang should much the language of the template.}; REM {For
example, en for English, de for German, and ja for Japanese.}; REM {The variable
in the hide column when formula in both Who columns should be same.};
TemplateLang := "en"; bUseAltName := @IsMember($LangFrom; TemplateLang);
bUseAltPrincipal := @IsMember($LangPrincipal; TemplateLang); bUseAltSendTo :=
@IsMember($NameLanguageTags; TemplateLang); tmpFrom := @If(bUseAltName &
(AltFrom != "") & (AltFrom != From); AltFrom; From); tmpPrincipal :=
@If(bUseAltPrincipal & ($AltPrincipal != "") & ($AltPrincipal !=
Principal); $AltPrincipal; Principal); tmpSendTo := @If(bUseAltSendTo &
(@Elements(AltSendTo) > 0) & (AltSendTo != SendTo); AltSendTo; SendTo);
SentBy := @If((Principal = "") | (Principal = From); tmpFrom; tmpPrincipal);
Attendees := @Trim(RequiredAttendees : OptionalAttendees); Who :=
@If(DeliveredDate != ""; SentBy; @Elements(Attendees) > 0; @Subset(Attendees;
1); SendTo = ""; SentBy; @Subset(tmpSendTo; 1)); CN1 := @Trim(@Name([CN]; Who));
CN := @If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G :=
@If(CN = ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S];
Who)); ""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report" ;
"Mail Router"; Person2)</formula>

</code>


- <code event="hidewhen">



<formula>TemplateLang := "en"; @If(@ClientType = "Notes";
@LocationGetInfo([NamePreference]) != "1"; @True)</formula>

</code>

</column>


- <column resort="ascending"
itemname="$111" width="1.3750" resizable="true"
separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidecolumntitle="true"
showasicons="true" align="left" responsesonly="false"
hidden="false" twisties="false" categorized="false"
showascolor="false" userdefinable="false" hideinr5="false"
readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" />

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


- <code event="value">



<formula>rfNum := @Text($RespondedTo); @If(rfNum = "1"; 178; rfNum = "2"; 179;
rfNum = "3"; 180; "")</formula>

</code>

</column>


- <column sort="ascending"
resort="descending" listseparator="comma" itemname="$68"
width="8"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" align="left"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@If(DeliveredDate != ""; DeliveredDate; PostedDate != ""; PostedDate;
@Created)</formula>

</code>

</column>


- <column align="right"
sort="ascending" resort="descending" itemname="$106"
width="5.6250" resizable="true" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Size"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
time="hourminutesecond" zone="never"
dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="twodigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
fourdigityearfor21stcentury="false" omitthisyear="false"
timeformat24="false" />


<numberformat format="general" digits="varying"
punctuated="true" parens="false" percent="false" />


- <code event="value">



<formula>@If( @IsDocTruncated; @If(@TextToNumber(@Version) < 172; @DocLength;
@DocOmittedLength + @DocLength); @DocLength)</formula>

</code>

</column>


- <column align="center"
itemname="$105" width="2" resizable="false" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
showasicons="true" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


- <code event="value">



<formula>@If(@TextToNumber(@Version) > 122; @If(@IsAvailable(_ViewIcon2);
_ViewIcon2; @Contains(@LowerCase(@AttachmentNames); "smime.p7s"); 12;
@Contains(@LowerCase(@AttachmentNames); "smime.p7m"); 61; @IsDocTruncated; 30;
@IsAvailable($ContentIcon); $ContentIcon; (@Contains(@LowerCase(From); " pager
") | @Contains(@LowerCase(SendTo); " pager ")); 46; @Attachments;
@If(@Contains(@LowerCase(@AttachmentNames); "message.wav" : "vmsg_hdr.wav"); 44;
@Contains(@LowerCase(@AttachmentNames); ".wav"); 15;
@Contains(@LowerCase(@AttachmentNames); ".tif"); 47; 5); 0);
@IsAvailable($ContentIcon); $ContentIcon; @Attachments; 5; 0)</formula>

</code>

</column>


- <column itemname="$74"
width="49.2500" resizable="true" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
align="left" showasicons="false" responsesonly="false"
hidden="false" twisties="false" categorized="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Subject"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


- <code event="value">



<formula>@If( form = "NonDelivery Report" & (!@IsAvailable(SMTPDSNType) |
SMTPDSNType = "0"); "DELIVERY FAILURE: " + FailureReason; form = "NonDelivery
Report" & @IsAvailable(SMTPDSNType) & SMPTDSNType != "0"; "DELIVERY
NOTIFICATION: " + FailureReason; Form = "Delivery Report"; "DELIVERED: " +
Subject; Form = "Return Receipt"; "RECEIVED: " + Subject; Form =
"ReturnNonReceipt"; "NOT RECEIVED: " + Subject; Subject)</formula>

</code>

</column>


- <column itemname="$113"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader title="$ExchangeMigRequireAddrFixUp" align="left" readingorder="lefttoright">



<font size="9pt"
style="bold" />

</columnheader>


- <code event="value">



<formula>@If( @IsAvailable($ExchangeMigRequireNameFixup);
$ExchangeMigRequireNameFixup; "2")</formula>

</code>

</column>


- <item name="$FormatNote"
summary="true" sign="false" seal="false"
sealed="false" authors="false" names="false"
readers="false" placeholder="false">



<rawitemdata
type="4">AQDLtLkShfEiYdlTXAC0cyWA</rawitemdata>

</item>

</view>


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