Print Out # Templates On A Server By Subdirectory

For design refresh purposes its convenient to use the .nsf format to save Notes
Templates. However, in a heavy development environment there may be too many
templates or duplicate names in a server directory, thereby complicating design
refresh. This script will allow you to quickly identify the culprits by
subdirectory.
Just put this in a button.

Sub Click(Source As Button)
%REM
This script returns the title of each template on a server. All results are
stored in a Word 97 file (My Documents\TemplateList.doc). 'Error' results are
also stored in a Word 97 file called
(My Documents\TemplateListError.doc). Both Word 97 files are sent to the
user's default printer, and are made visible to the user at the end of the
script.

Author: David E Bradshaw
Last Edit: 5/13/99
%END REM


Messagebox "This script will return all templates housed on a particular
Server, by desired subdirectory. The results will be sent to a Word 97 file"&_
" called 'C:\My Documents\TemplateList.doc', while any 'ERROR' results
will be sent to a Word 97 file called 'C:\My Documents\TemplateListError.doc'.
" &_
"Please go to these files to view results.", 64, "Template Search Results"

On Error Goto ExecuteFail


Dim s As New NotesSession
Dim db As NotesDatabase
Dim directory As NotesDbDirectory
Dim servername$
Dim templatename$
Dim desPath$
Dim corrPath$
Dim adjPath$
Dim pathCnt%

Set directory = s.GetDbDirectory(Ucase(Inputbox("Please Enter Server
Name. Leave blank for Local.")))
desPath$ =Ucase(Inputbox("Please Enter Desired Directory (eg
Tax\Temp\Files\)."))
pathCnt% = Len(desPath$)

'check for an available file number to use. If none exists then assign
the next available one for use in
' creating/opening the desired filename. If a number is already in use
then, close it.

servername$=directory.Name
If Not fileNum%>0 Then
fileNum% = Freefile()
Else
Close filenum%
End If
Open "c:\My Documents\TemplateList.doc" For Output As fileNum%

Set db = directory.GetFirstDatabase( DATABASE ) 'only look for the '.nsf'
extension
x=0 'initialize counter
y=0 'initialize count for dbs in desired path
Print #fileNum%,("TEMPLATES HOUSED ON SERVER " & servername$ & " -
DIRECTORY: "&desPath$&Chr(13))
Print #fileNum%,("Templates by Number per below: "&Chr(13))
Print #fileNum%,(Chr(13))
Do While Not (db Is Nothing )

templatename$= db.TemplateName ' will only respond if the .nsf is in
fact a template
corrPath$ =Ucase(db.FilePath) ' get the full file path of the database
adjPath$ = Ucase(Left(corrPath$,pathCnt%)) ' adjust the path to the
# of characters entered in desired subdirectory for comparison
' If Left$(templatename$,3) ="NTF" And (desPath$=adjPath$) Then 'look
only for those templates beginning with "NTF" and located in desired
subdirectory
If (desPath$=adjPath$) Then 'look only for those templates located
in desired subdirectory
y=y+1
'Loop through the SERVER and record the name of the templates in the Word
97 file

If db.IsOpen Then
Print #fileNum%,("# " & y & " - "&templatename$ &" - "
&db.FilePath &Chr (13))
Else
Call db.Open("","")
Print #fileNum%,("# " & y & " - "&templatename$ &" - "
&db.FilePath &Chr (13))

End If
End If

x=x+1 'keep a running count of the templates found.
Set db = directory.GetNextDatabase
Loop

Print #filenum%,(Chr(13))
Print #fileNum%,("There were " & y & " templates found in " &servername$ &
"\" & desPath )
Print #fileNum%,("There were a total of " & x & " templates found on
server " & servername$ )
Close fileNum% 'close the file number
Close fileNum2% 'close the file number after all error results have been
written to the Word 97 error results
This was first published in November 2000

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