FredinThailand Posted October 18, 2007 Share Posted October 18, 2007 First of all, i am not a programmer. What i need to do is find a way to chose the twain device to use to input an image into a Filemaker container. I use a plug in to do the scan but need to chose which device to use, to use a scanner or a camera. Thank you in advance Fred Link to comment Share on other sites More sharing options...
torun Posted January 18, 2008 Share Posted January 18, 2008 I have noticed that several posts regarding TWAIN devices are lef (partially) unanswered, so here is my contribution. The purpose is only to give an example, so there is much room for improvement.First of all get eztw32.dll (www.dosadi.com).Put it in the directory of the script.Run the script.The script will:check for the presence of the dllcheck for the availability of TWAINlets you select a devicelets you acquire an image to a fileThere are many other features in the dll not used (like raw data handling). See the information that comes with the dll.I ran the script on WIN2K with an HP ScanJet 3400C.This will probably also answer (part of) following topics:topic 48948topic 23463topic 27503CODE;Include constants#include <GUIConstants.au3>#include <GuiEdit.au3>;Initialize variablesGlobal $GUIWidthGlobal $GUIHeight$GUIWidth = 290$GUIHeight = 250;Create window$hwnd = GUICreate("TWAINtest", $GUIWidth, $GUIHeight);Create a form with buttons$button1 = GUICtrlCreateButton("check", 10, 20, 60, 25)$button2 = GUICtrlCreateButton("select", 10, 60, 60, 25)$button3 = GUICtrlCreateButton("acquire", 10, 100, 60, 25);...and with labels to display messages$edit1 = GUICtrlCreateLabel("", 80, 25, 200, 25)$edit2 = GUICtrlCreateLabel("", 80, 45, 200, 25)$edit3 = GUICtrlCreateLabel("", 80, 65, 200, 25)$edit4 = GUICtrlCreateLabel("", 80, 105, 200, 25);Disable buttonsGUICtrlSetState($button2, $GUI_DISABLE)GUICtrlSetState($button3, $GUI_DISABLE);Show window/Make the window visibleGUISetState(@SW_SHOW)While 1 $msg = GUIGetMsg()Select Case $msg = $GUI_EVENT_CLOSE;Destroy the GUI including the controlsGUIDelete();Exit the scriptExit Case $msg = $button1;Get the DLL version (211 means 2.11, so divide by 100) $rc = DllCall('EZTW32.DLL','long','TWAIN_EasyVersion');@error returns error from DllCall function if @error <> 0 then _GUICtrlEdit_SetText($edit1,'eztw32.dll load error') else _GUICtrlEdit_SetText($edit1,'eztw32.dll version: ' & $rc[0]/100) $rc = DllCall("eztw32.dll","long","TWAIN_IsAvailable") _GUICtrlEdit_SetText($edit2,'TWAIN available: RC = ' & $rc[0]) if $rc[0] <> 0 then GUICtrlSetState($button2, $GUI_ENABLE) endif endifCase $msg = $button2;Select image source;A new window is openened and the select source manageris displayed;All available TWAIN devices should be in the list $rc = DllCall("eztw32.dll","long","TWAIN_SelectImageSource",'hwnd',$hwnd) if $rc[0] <> 0 then GUICtrlSetState($button3, $GUI_ENABLE) _GUICtrlEdit_SetText($edit3,'TWAIN device selected') else _GUICtrlEdit_SetText($edit3,'no TWAIN device selected') endif Case $msg = $button3;Acquire image to a file $rc = DllCall("eztw32.dll","long","TWAIN_AcquireToFilename","hwnd",$hwnd,"str","") _GUICtrlEdit_SetText($edit4,'RC = ' & $rc[0])EndSelectWEnd iFFgen 1 Link to comment Share on other sites More sharing options...
Ashygan Posted April 18, 2009 Share Posted April 18, 2009 I have noticed that several posts regarding TWAIN devices are lef (partially) unanswered, so here is my contribution. The purpose is only to give an example, so there is much room for improvement....Hi,Thank you very much for your snippet. Ready to use, works like a charm ! I saw you were using an HP printer. Did you manage to get rid of the HP window that lets you enter your scan parameters, crop the image and so on ? I'm planning to build a little software to manage my bills and refunds (just select bill type and month, click on scan button and it will write an image file in a directory depending on what type of bill and year). It'd really ease my pain if I could just click my button and it will create the file without having to wait for preload and so on.I checked the eztwain dll source, but I couldn't find a way to disable the printer's window.Do you have an idea ?Thx Link to comment Share on other sites More sharing options...
NBJ Posted April 19, 2009 Share Posted April 19, 2009 @FredinThailand - Which Plugin are you using? Which Version of FileMaker? I have copies of FM here various versions I may be able to help. Cheers NBJ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now