• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Allow users to browse network select path and paste to field

Hola Experts,

In one of our forms the user has to input a file path that they would like to allow other users access to, currently it's an editiable field, is there anyway of allowing the user to say click a button open a window that will allow them to browse the network, select the path then paste it to a field?
0
padillrr
Asked:
padillrr
  • 8
  • 7
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
This might help you:
    http:Q_21761329.html "OpenDirDialog ??"
0
 
padillrrProject CoordinatorAuthor Commented:
Hey Sjef, looked at Bens stuff, but have lots of errors when trying to save. There is an app out there I think I got it from the snadbox called link hotsopt creator, does almost what I need except that it requires a file selection as well, I just want it to go to the folder level, heres the agent code:

'The following declaration will work only on Windows environments.
Declare Function NEMGetFile Lib "NNOTESWS" Alias "NEMGetFile" _
( Z As Integer, Byval N As String, Byval F As String, Byval T As String ) As Integer
Sub Initialize
      
      'Created by John Buoro - (C) Copyright 2002
      '13/07/2002 - Code created.
      '16/07/2002 - Version 1.0 released.
      '10/09/2002 - Removed Kill statement for Notes.Net.
      
      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim filename As String
      Dim TempFileName As String
      
      'Select the file.
      n$ = String$(1024, " ")
      f$ = "All Files|*.*|Acrobat Files|*.PDF|Excel Documents|*.XLS|Word Documents|*.DOC|PowerPoint Presentations|*.PPT|PowerPoint Slides|*.PPS|"
      ret% = NEMGetFile( 0, n$, f$, "Create File Link Hotspot")
      If ret% = 0 Then Exit Sub
      filename = Fulltrim(n$)
      
      'Get the working document.
      Set uidoc = workspace.CurrentDocument
      
      'Clear the link field.
      Call uidoc.FieldSetText( "Pro_Path", "" )
      
      'Construct the html code.
      Call uidoc.FieldSetText( "HTML", "<html><a href=""file:\\" + filename + """>" +FileName+ "</a></html>" )
      s = uidoc.FieldGetText( "HTML" )
      
      'Write the html code to a temp file.
      fileNum% = Freefile()
      TempFileName$ = "c:\LinkHotspotCreator.htm"
      Open TempFileName$ For Output As fileNum%
      Print #fileNum%, s
      Close fileNum%
      
      'Import the html file into a rich text field.
      uidoc.GotoField( "Pro_Path" )
      Call uidoc.Import("HTML File",TempFileName$)
      
      'Copy to clipboard.
      Call uidoc.GoToField( "Pro_Path" )
      Call uidoc.SelectAll
      Call uidoc.Copy
      'Messagebox "You can now paste your link into any richtext field.", 0 + 64, "Create File Link Hotspot"
      
      'Clean up.
      'Kill TempFileName$
      'Call uidoc.Close
      
End Sub
0
 
Sjef BosmanGroupware ConsultantCommented:
Read my question, there is nothing for the folder level... :(
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
padillrrProject CoordinatorAuthor Commented:
The code I pasted actually give me more then what I need, if there anyway to avoid pasting the file name even if they have to select the file when it goes to paste have it delete that portion of the path.....I can send you a copy of the link hotspot creator db maybe you can make some mods and get it to do what we need?!?!?
0
 
SysExpertCommented:
All you would need to do is strip off the last porion from the last \ in the path.

This is easy with function

STRleftback or similar

I hope this helps !
0
 
Sjef BosmanGroupware ConsultantCommented:
Would you do that yourself??

Ray, you tried Ben Poole's code? It does what you want, actually. Here's thelink again:
    http://www.benpoole.com/80256B44004A7C14/articles/lotusscriptversionlocalbrowse
0
 
Sjef BosmanGroupware ConsultantCommented:
There are no errors. Just create a new LotusScript library, whack the code in, save it, and use the function call to get a folder name.

These three lines in the middle should be removed, they are just example code:

    Now I'll list the main body of the code, i.e. the Lotusscript function. First, here's an example call:

    Dim strFolderPath As String
    strFolderPath = BrowseForFolder()
0
 
padillrrProject CoordinatorAuthor Commented:
I created the agent, added a button to the form and called it from there with no results. It doesn't open a window for browing the network, any ideas? Plus once i have the path how do I get it to be pasted to a field?
0
 
Sjef BosmanGroupware ConsultantCommented:
Very strange... I had no problems with it.

To get the data into a field, use
    doc.Pathname= strFolderPath
assuming you have a field Pathname on the form, the form and the document are in edit-mode and you have a variable doc with the current NotesDocument.
0
 
padillrrProject CoordinatorAuthor Commented:
I have got to be doing something wrong.....

I imported the agent from the site into an agent, it saved with no errors, I created a button on the form and added @Command([ToolsRunMacro];"(GetPath)") as the formula. I assume when i click the button that the agent would run and open a window to browse the network. Nothing Happens,  try to run the debugger on it and it just flashes once and right back to the form. What do you mean by "and use the function call to get a folder name."
0
 
Sjef BosmanGroupware ConsultantCommented:
What's in your GetPath-agent then? And why is the code not just in a button on your form?
0
 
padillrrProject CoordinatorAuthor Commented:
I got it to work by creating a script library, then creating an agent to call it, I call the agent from the button.

Here's the agent code:

Sub Initialize
      
      Dim Session As Notessession
      Set session = New Notessession
      
      Dim db As NotesDatabase
      
      Dim doc As NotesDocument
      Dim strFolderPath As String      
      Dim Pro_Path As String
      Set db = session.CurrentDatabase
      
      strFolderPath = BrowseForFolder()
      'Messagebox "The folder you chose is '" & strFolderPath & "'.", 0, "LocalBrowse"
      
      doc.Pro_path= strFolderPath
      
End Sub
0
 
Sjef BosmanGroupware ConsultantCommented:
Aaaah! Perfect!
0
 
padillrrProject CoordinatorAuthor Commented:
Raised the points, what did I do wrong here? I get an object variable not set at doc.pro_path = StrFolderPath
0
 
Sjef BosmanGroupware ConsultantCommented:
You have to get doc, it has no object yet.

Is there a current document? Then:
     Dim Session As Notessession
     Set session = New Notessession
    Dim ws As New NotesUIWorkspace
     
     Dim db As NotesDatabase
     
     Dim doc As NotesDocument
     Dim strFolderPath As String    
     Dim Pro_Path As String
     Set db = session.CurrentDatabase
    Set doc= ws.CurrentDocument.Document
0
 
padillrrProject CoordinatorAuthor Commented:
Thanks! That did it, I have to get more practice with my Lotus Script!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now