문제

i made this lotus notes script to allow me to retrive the folder address of my computer and put the address retrived in a "field arc_file":

Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0
Const OPTIONS = 0

Const BIF_returnonlyfsdirs   = &H0001
Const BIF_dontgobelowdomain  = &H0002
Const BIF_statustext         = &H0004
Const BIF_returnfsancestors  = &H0008
Const BIF_editbox            = &H0010
Const BIF_validate           = &H0020
Const BIF_browseforcomputer  = &H1000
Const BIF_browseforprinter   = &H2000
Const BIF_browseincludefiles = &H4000

Set uidoc=work.CurrentDocument
If uidoc.EditMode=False Then uidoc.EditMode=True
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path     
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "Seleziona una cartella:", OPTIONS+ BIF_browseincludefiles , strPath)   
If Not (objFolder Is Nothing) Then
    Set objFolderItem = objFolder.Self
    Call uidoc.FieldSetText("arc_file",Cstr(objFolderItem.Path))
End If

this script retrive me for ex: c:\folder1\folder2

But i don't know if there is a method to retrive the adderess of a file with also the file name, for exampel c:\folder1\folder2\image.jpg and when i click on a bottom that open the specific folder (using x=Shell("explorer /root, " & uidoc.FieldGetText("arc_file"),1)) the file is already selected... there is someone can help me ? thank's

도움이 되었습니까?

해결책

Best is to use the methods in NotesUIWorkspace: To get a file is just:

Dim ws as New NotesUIWorkspace    
Dim varFile as Variant
varFile = ws.OpenFileDialog( False ) 'for one file, for multiple files use True

To get a folder use:

Dim ws as New NotesUIWorkspace    
Dim varFolder as Variant
varFolder = ws.SaveFileDialog( True ) 'in this case True = directories only

In varFile(0) / varFolder(0) is the foldername, or isEmpty( varFile ) is true, if nothing selected

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top