Q
Problem solve Get help with specific problems with your technologies, process and projects.

Import a picture into a document, not as a link

Can LotusScript be used to import a picture into a document so that when the document is opened you see the both the picture (not just a link) and the other information on the document?

Of course! Here's a snippet:

Dim nudCurrent As NotesUIDocument
Dim sFilename As String
Dim iTempCount As Long
Dim sTemp As String
Dim sFileExtension As String
Dim wsCurrent As New NotesUIWorkspace
Set nudCurrent = wsCurrent.CurrentDocument

sFilepath = Input$("Enter the file path:")
sFilename = Input$("Enter the filename to import:")
'Get extension
If Instr(sFilename, ".") > 0 Then
	iTempCount = 1
	sTemp = Right$(sFilename, iTempCount)
	While Left$(sTemp, 1) <> "."
		iTempCount = iTempCount + 1
		sTemp = Right$(sFilename, iTempCount)
	Wend
	sFileExtension = Right$(sFilename, iTempCount - 1)
Else 
	sFileExtension = ""
	iTempCount = 0
End If
sFileExtension = Ucase$(sFileExtension)
If (sFileExtension = "JPG" Or sFileExtension = "GIF" Or sFileExtension = "CGM" Or sFileExtension = "BMP") Then
	Call nudCurrent.GotoField("Body") ?a RT Field
	Select Case sFileExtension
	Case "JPG":
		sFiletype = "JPEG Image"
	Case "GIF":
		sFiletype = "GIF Image"
	Case "CGM":
		sFiletype = "ANSI Metafile"
	Case "BMP":
		sFiletype = "BMP Image"
	Case Else
		sFileType = "ASCII Text"
	End Select
	Call nudCurrent.Import(sFiletype, sFilepath & "\" & sFilename)

As you can see the hard part is getting the file name and type.


Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

The snippet is almost correct, there is one/two errors in it:
the Input$ statements should have been InputBox$ ones !
Input$ tries to read an input file using a handle and a number of chars to read.
Obviously, the reading is done later, and the intention was just to pick a filepath and filename from the user.
Cancel

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close