Prompt For Location To Save File

3,845 pts.
Tags:
Lotus Notes
Lotus Notes 6.x
Lotus Notes 8.x
Lotus Notes Save File
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?
ASKED: January 23, 2009  8:01 PM
UPDATED: January 28, 2009  3:36 PM

Answer Wiki

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

Try this code (LS) :
<pre>
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 + “”
Else
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
Else
sFichier = Files(0)
End If
</pre>

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 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:
    report
  • 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,110 pointsBadges:
    report
  • 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:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following