Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
ImageCapture.RequestScan
Starts a scan on selectedFunctionalUnit.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
ImageCapture | 6.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Wait | Pass 1 to wait till complete. Or pass 0 to return immediately. Default is 1 to wait. |
0 | Optional |
Result
Returns OK or error.
Description
Starts a scan on selectedFunctionalUnit.If a progress dialog from our plugin is visible, the plugin will keep it updated with progress.
Please use ImageCapture.SetParameter to configure scanner before requesting the scan, e.g. for duplex.
MBS Plugin 8.5 and newer observes progress and returns timeout error if scanner didn't do anything for 60 seconds.
Please call ImageCapture.OpenDevice to open device before requesting a scan.
Examples
Scan images:
# 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"; "scanArea"; 0; 0; $physicalWidth; $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 [$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 Flatbed 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
Run scan with duplex:
# 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"; "A4") ]
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"; "duplexScanningEnabled"; 1) ]
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 Flatbed 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 [ Text Result: ]
End If
#
# read images
Pause/Resume Script [ Duration (seconds): ,1 ]
Set Variable [ $Paths ; Value: MBS("ImageCapture.ImagePaths") ]
If [ Length ( $Paths ) > 0 ]
Set Variable [ $Count ; Value: ValueCount ( $Paths ) ]
If [ $Count > 0 ]
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 [ With dialog: Off ]
Set Variable [ $Index ; Value: $index + 1 ]
Exit Loop If [ $index > $count ]
End Loop
End If
End If
See also
- ImageCapture.cancelScan
- ImageCapture.ImagePaths
- ImageCapture.OpenDevice
- ImageCapture.RequestSyncClock
- ImageCapture.SetParameter
- ProgressDialog.Hide
- ProgressDialog.SetBottomText
- ProgressDialog.SetButtonCaption
- ProgressDialog.SetTitle
- ProgressDialog.SetTopText
Release notes
- Version 10.1
- Removed check from ImageCapture.RequestScan to check for open session.
- Version 8.3
- Added wait parameter for ImageCapture.CloseDevice, ImageCapture.OpenDevice, ImageCapture.RequestDeleteFiles, ImageCapture.requestOverviewScan, ImageCapture.requestScan and ImageCapture.requestSelectFunctionalUnit functions.
- Version 7.0
- Changed ImageCapture.requestScan to better report errors, e.g. empty document feeder.
Blog Entries
- MBS FileMaker Plugin, version 10.1pr3
- MBS FileMaker Plugin, version 8.3pr3
- MBS FileMaker Plugin, version 7.0pr1
- ImageCapture functions for Mac OS X
FileMaker Magazin
Created 11st September 2016, last changed 27th May 2021
ImageCapture.RequestOverviewScan - ImageCapture.RequestSelectFunctionalUnit