Blogs

  • Browse Blogs
  • My Blog
  • My Updates

Tags Help

  • View as cloud  | list

Similar Entries

photo

DominoDatabase.HasRo...

Blog:  .Domino Frame...
Peter Presnell
Updated 
No Ratings 0     No Comments 0
photo

DominoDocument.XML

Blog:  .Domino Frame...
Peter Presnell
Updated 
No Ratings 0     No Comments 0
photo

Extending a Java Cla...

Blog:  .Domino Frame...
Peter Presnell
Updated 
No Ratings 0     No Comments 0
photo

XSLT Transformation ...

Blog:  .Domino Frame...
Peter Presnell
Updated 
No Ratings 0     Comments 3
photo

New DominoDatabase.R...

Blog:  .Domino Frame...
Peter Presnell
Updated 
No Ratings 0     No Comments 0

Dogear Bookmarks

.Domino Framework

Blog Authors:  Peter Presnell  

Previous |  Main  | Next

@GetFile & @GetFileContents

Peter Presnell  |     |  Tags:  .dominoframework files  |  Comments (0)

The 0.6 Beta of the .DominoFramework already included a LotusScript implementation of the hypothetical @GetFile function.  This provides a shortuct to request the operating system to prompt the  user to select a file from the operating system using an undocument option of the NotesUIWorkspace.Prompt method:-

'/**
' * Prompts user to select a OS file using undocumented UIW.Prompt option
' *
' * @author Peter Presnell
' * @param  Default File Initial file name 
' * @return  Name of selected file (empty if cancel selected)
' */
Function atfGetFile(DefaultFile As String) As String
 Dim Title As String
 If DB Is Nothing Then Title$ = ".Domino Framework" Else Title$ = DB.Title$
 atfGetFile$ = Cstr(UIW.Prompt(12,Title$,"",DefaultFile$))
End Function

The next release of the .Domino Framework will also provide an implementation of the hypothetical @GetFileContent function.  This function can either take a filename as a parameter or prompt the user for a filename and then returns the contants of that filename in a NotesStream.  Again it acts as a shortuct way of getting the contents of a file without the need to repeat the LotusScript code to do this.

'/** ' * Reads the contents of a nominated file ' * ' * @author Peter Presnell ' * @param Source NAme of file to be read (Where non is provided the user is prompted to provide the file name) ' * @returns NotesSTream containing the contents of the file ' */ Function atfGetFileContent(Source As Variant) As NotesStream Dim FileName As String ' Name of file whose content is to be read Dim FileNum As Integer ' File number Dim Text As String ' Line of text read from file Try: On Error Goto Catch If Session.IsOnServer Then Exit Function Set atfGetFileContent = Session.CreateStream() Select Case Typename(Source) Case "STRING" If FileName$ = "" Then FileName$ = atfGetFile("") Else FileName$ = Cstr(Source) Case Else FileName$ = atfGetFile("") End Select If (FileName$ = "") Then Exit Function FileNum% = Freefile() Open FileName$ For Input As FileNum% Do While Not Eof(FileNum%) Line Input #FileNum%, Text$ Call atfGetFileContent.WriteText(Text$,EOL_CRLF) Loop atfGetFileContent.Position& = 0 Goto Finally Catch: Stop Call ReportError() Resume Finally Finally: If (FileNum% <> 0) Then Close FileNum% End Function

Comments

Previous |  Main  | Next
Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About

Tags

A tag is a keyword that is used to categorize an entry. To view the entries with a particular tag, click a tag name or enter a tag in the box.
The tag cloud indicates the frequency of tag use. Popular tags appear darkest. The slider control adjusts how many tags are displayed in the tag cloud.