« A Programmer's Day Xo… | Home | Replace toolbar image… »

ImageCapture functions for Mac OS X


For next version of our FileMaker plugin, got a few new ImageCapture functions.

Those functions should allow you to scan images from a flatbed or document feeder scanner. Even for 64-bit and without TWAIN drivers.


So all scanners working in Digital Images application coming with OS X should work just fine in FileMaker. You can query device informations and parameters. And of course you can set parameters like whether you like to get gray scale or color images, the file type, resolution or the area to scan. All scans are performed to files on disk in a given directory. Than you can import them to container fields. Here a sample script:

# set parameters

Set Variable [$physicalWidth; Value:MBS("ImageCapture.GetParameter"; "physicalWidth")]

Set Variable [$physicalHeight; Value:MBS("ImageCapture.GetParameter"; "physicalHeight")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "documentType"; "USLetter")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "documentName"; "Scan")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "resolution"; 300)]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "bitDepth"; 8)]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "pixelDataType"; "RGB")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "documentUTI"; "jpeg")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "downloadsDirectory"; "temp")]

Set Variable [$r; Value:MBS("ImageCapture.SetParameter"; "scanArea"; 0; 0; $physicalWidth; $physicalHeight)]

Set Variable [$p; Value:MBS( "ProgressDialog.Reset")]

Set Variable [$p; Value:MBS( "ProgressDialog.SetTitle"; "Scanning" )]

Set Variable [$p; Value:MBS( "ProgressDialog.SetBottomText"; "" )]

Set Variable [$p; Value:MBS( "ProgressDialog.SetTopText"; "Scan from Flatbet scanner." )]

Set Variable [$p; Value:MBS( "ProgressDialog.SetButtonCaption"; "Cancel" )]

Set Variable [$p; Value:MBS( "ProgressDialog.SetProgress"; -1 )]

Set Variable [$p; Value:MBS( "ProgressDialog.Show" )]

Set Variable [$r; Value:MBS("ImageCapture.requestScan")]

Set Variable [$p; Value:MBS( "ProgressDialog.Hide" )]

If [MBS("iserror")]

Show Custom Dialog ["Failed start scan"; MBS("Text.RemovePrefix"; $r; "[MBS] ")]

Exit Script []

End If

Set Variable [$Paths; Value:MBS("ImageCapture.ImagePaths")]

Set Variable [$Count; Value:ValueCount ( $Paths )]

Set Variable [$Index; Value:1]

Loop

Set Variable [$Path; Value:GetValue($Paths; $index)]

New Record/Request

Set Field [Images::Image; MBS("Container.ReadFile"; $path)]

Set Variable [$r; Value:MBS( "Files.Delete"; $Path )]

Commit Records/Requests [No dialog]

Set Variable [$Index; Value:$index + 1]

Exit Loop If [$index > $count]

End Loop

 
PS: For Xojo we have the classes already in our MBS Xojo Leopard Plugin.
12 09 16 - 11:59
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.