• Browse Blogs
  • My Blog
  • My Updates

+Tags Get help with tags?

  • View as cloud  | list

+ Similar Entries

photo

Bringing The Power O...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     No CommentsComments 0
photo

Adding the "X" Facto...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 2
photo

Tagging Design Eleme...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 1
photo

Add Discussion Threa...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 2
photo

New Video Includes S...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     No CommentsComments 0

+ Bookmarks

+ Blog Authors  

@GetFile & @GetFileContents

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

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
No RatingsRatings 0

Comments (0)

There are no comments to display Add a Comment Add a Comment

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