Workspace.Prompt for OS Folder or File

Mindwatering Incorporated

Author: Tripp W Black

Created: 09/23/2012 at 06:37 PM

 

Category:
Notes Developer Tips
LotusScript

Issue:
You need cross platform support (Windows and Mac) and want to be able to select a folder or a file (similar to @Command([LocalBrowse]).

Solutions:

Folder:
For a folder, you can use:
'get a handle on the uidoc
Set uidoc = ws.CurrentDocument

'prompt the user to choose a folder
folderpath = ws.Prompt ( 14 , "" , "" )

'write selected folder path to a field
Call uidoc.FieldSetText ( "F_FolderPath" , folderpath )


Files:
For files, you have more options...
(Lotuscript)

w.OpenFileDialog(...)

or

'prompt the user to choose a folder
attachfilepath = ws.Prompt ( 12 , "Choose File" , "Select a JPG or GIF image." )

'write selected file to a field
If Not (attachfilepath = "") Then
Set aItem = doc.GetFirstItem("MWPhoto")
Call aItem.EmbedObject(1454, "", attachfilepath)
Call doc.Save(True, False)
End If

(Formula)
tmppath:= @Prompt([LocalBrowse]; "Select an Image"; "3");
@Command([EditGotoField]; "MWPhoto");
@Command([EditInsertFileAttachment]; tmppath)


previous page