Prompt For Location To Save File

3845 pts.
Lotus Notes
Lotus Notes 6.x
Lotus Notes 8.x
I have an extract function that switches forms, then extracts the form as a .rtf file to a prescribed location on a user's machine. I would like give the users the option of where to save the file instead. I would also like to include a default name for the file, but give them the option to change the name. After they have saved the extract, I want to prompt them, asking whether they want to open the file for review, so if they browse to a location, I will need to know where they saved the file and the name they gave it. Any ideas?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try this code (LS) :
Dim session As New NotesSession
Dim ws As New NotesUIWorkSpace
Dim sPathFichier As String, sNomFichier As String
Dim sFichier As String, tempDir As String
Dim files As Variant

‘ Try to find the system temporary folder
tempDir = Environ(“Temp”)
If tempDir <> “” Then
tempDir = tempDir + “”
tempDir = “C:”
End If

sNomFichier = “YourFileNameToPropose.RTF”
sFichier = tempDir & sNomFichier

files = ws.OpenFileDialog(False, “Choose the destination folder”, _
“YourFileNameToPropose.RTF|*.rtf”, _
tempdir, “YourFileNameToPropose.RTF”)

If Isempty( files ) Then
Print “No directory or file selected !”
Exit Sub
sFichier = Files(0)
End If

You may then do what you have to do with the “sFichier” variable….

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Brooklynegg
    Thanks, BruceWayne. My current extract code is @formula, but I will see if I can convert it all to script. should definitely be possible.
    3,845 pointsBadges:
  • BruceWayne
    Yep ... Not sure you can do this with @command (not enough parameters), but you could copy the LS code in an agent "YourAgentName", and call it with @Command([ ToolsRunMacro] ; "YourAgentName") You have to save the "sFichier" variable in the Notes.ini for further use with adding this line to the LS code : Call session.SetEnvironmentVar( "FileUserChoice" , sFichier , False) Then, you could read the result with @Environment("FileUserChoice") in your formula ... Tell me if it works !
    4,465 pointsBadges:
  • Brooklynegg
    After mulling this over, that's exactly what I have decided to do. I have absolutely no doubt it will work, and work well. Many of our existing functions of this type are not used much by regular users. Administrative users that extract data for export to other systems are the big users and those functions are used quite a bit and well known. Some remediation will surely become "delete this function," which will reduce the already small complexity of this change. Thanks again for the code suggestion. I had seen a reference to 'Environ("Temp")' in Notes help, but did not realize how it could be used.
    3,845 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: