OpenNTF.org - Acquire Image From Scanner in
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Acquire Image From Scanner in Windows XP 
Rating:
Rating: 2 , Number of votes: 1 
Contributor:
Daniele Grillo 
Category:
Lotusscript 
Type:
Example Code 
Last Modified:
22 Feb 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Set objWIA = CreateObject("Wia.Script")

Set objDeviceInfoCollection = objWia.Devices

Forall objDeviceInfo In objDeviceInfoCollection
Set objRootItem = objWia.Create(objDeviceInfo)
Set objSelectedItems = objRootItem.GetItemsFromUI(0, 0)
If objSelectedItems Is Nothing Then
Exit Sub
End If
Forall objItem In objSelectedItems
percorso="c:\filetemp.bmp"
objItem.Transfer(percorso)

strFieldname = wks.currentdocument.CurrentField
Set RT = doc.GetFirstItem("allegato")
Set object = RT.EmbedObject(1454, "", percorso, "AttachName")
Kill percorso

If session.NotesBuildVersion >= 190 Then
RT.Update ' ND6 only
Else
Call doc.ComputeWithForm(True, False)
End If
doc.SaveOptions = "0"
Call wks.currentdocument.Close(True)
Set uidocNew = wks.EditDocument(True, doc, , , , True)
uidocNew.Document.RemoveItem("SaveOptions")
If strFieldname "" Then uidocNew.GotoField(strFieldname)

End Forall
End Forall

Usage / Example
In Windows XP you can use WIA for comunicate with WebCam or Scanner Device and transfert file to a Rich-Text.
 Comments
Posted by Patrick Kwintensson on 04/27/2006 06:36:39 AMhow to use?
a sample database would be nice. I receive an OLE Automation Error
-> info@quintessens.com
Thanks in advance
Patrick
Posted by Padma Vemulakonda on 06/07/2006 05:56:33 PMVariant does not contain an object error for wks
Hello,
I am trying to use the code you have provided and I am getting an error "Variant does not contain an object" for wks. How should I declare wks and what should I set it to? The code doesn't have wks set. Also do you need to download any "Wia.Script". Please help.
Posted by Padma Vemulakonda on 06/07/2006 06:09:03 PMCan you provide the full code please
Can you please provide the full code. Some of the variables you have set are not declared/set/initialized in the code provided. Your response will be appreciated.
Posted by Padma Vemulakonda on 06/08/2006 02:32:23 PMfile name
instead of hard coding the same file name because I want to attach multiple documents can you suggest dynamically generate file name.
Posted by Padma Vemulakonda on 06/08/2006 05:17:55 PMdoesn't work in edit mode
I am trying t get this working in edit mode but unable to. It works fine in the read mode. Am I missing something?
Thanks,
Padma
Posted by JUSTIN COLEMAN on 01/31/2007 04:29:51 PMStill problems with this script
Hello All - No ones seams to get a responce here. This script fall over with what Padma get "Variant does not contact object" can someone help. I would be nice for a sample. Can anyone look at this scrpt and try it who has a more lotus script than me. I just want a script to scan into a RichText field in Notes - It can't be that hard. Thanks all. Justin.Coleman@yahoo.com
Posted by Vasyl Melnychuk on 12/27/2007 03:07:00 AMWindows Image Acquisition Automation Library v2.0 Tool
Check this:
http://www.microsoft.com/downloads/details.aspx?FamilyID=a332a77a-01b8-4de6-91c2-b7ea32537e29&DisplayLang=en
Posted by Vasyl Melnychuk on 12/27/2007 04:19:51 AMWorking example for Notes 7.0.2
conversion into another formats can be done here:
http://msdn2.microsoft.com/en-us/library/ms630819(VS.85).aspx#FilterSharedSample016
Sub TestAttachUI
Dim wks As New NotesUIWorkspace
Dim ses As New NotesSession
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim rt As NotesRichTextItem
Set uidoc = wks.CurrentDocument
Set doc = uidoc.Document
doc.form = "doc" 'default form for document
Set objWIA = CreateObject("Wia.Script")
Set objDeviceInfoCollection = objWia.Devices
Forall objDeviceInfo In objDeviceInfoCollection
Set objRootItem = objWia.Create(objDeviceInfo)
Set objSelectedItems = objRootItem.GetItemsFromUI(0, 0)
If objSelectedItems Is Nothing Then
Exit Sub
End If
Forall objItem In objSelectedItems
FileName="C:\scandoc.bmp"
objItem.Transfer(FileName)
strFieldname = wks.currentdocument.CurrentField
Set rt = New NotesRichTextItem( doc, "Body" )
Set object = RT.EmbedObject(1454, "", FileName, "")
Kill FileName
If ses.NotesBuildVersion >= 190 Then
RT.Update ' ND6 only
Else
Call doc.ComputeWithForm(True, False)
End If
doc.SaveOptions = "0"
Call wks.currentdocument.Close(True)
Call wks.EditDocument(True, doc, , , , True)
Set uidoc = wks.CurrentDocument
uidoc.Document.RemoveItem("SaveOptions")
If strFieldname = "" Then uidoc.GotoField(strFieldname)
End Forall
End Forall
End Sub
 Add your comment!