Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4    Statistic  

ImageCapture.SetParameter

Sets a parameter for current scanner functional device.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
ImageCapture 6.4 Yes No No No No

MBS( "ImageCapture.SetParameter"; Selector; Value )

Parameters

Parameter Description Example value
Selector The value to set. "documentName"
Value The value to set.

Result

Returns OK or error.

Description

Sets a parameter for current scanner functional device.

SelectorDescriptionExample
bitDepthThe bit depth to use when performing the final scan. This will always be one of the supported bit depths.8
documentNameThe document name.„Scan"
documentTypeCurrent document type.„A4"
documentUTIThe document UTI. Can be set using JPEG, JPEG2000, PDF, TIFF or PNG.„JPEG“
downloadsDirectoryThe downloads directory. If you pass „temp“, we use the user’s temp folder.„/Users/cs/Desktop“
maxMemoryBandSizeThe total maximum band size requested when performing a memory based transfer.
measurementUnitCurrent measurement unit. Can be Inches, Centimeters, Picas, Points, Twips or Pixels.„Inches"
overviewResolutionOverview image resolution. Value assigned to this will be contrained by resolutions allowed by the device.
resolutionCurrent scan resolution. This will always be one of the supported resolution values.300
thresholdForBlackAndWhiteScanningThreshold value to be used when performing a scan in black & white. This value should be from 0 to 255.127
transferModeThe transfer mode for scanned document. Can be File or Memory, but Plugin only supports File.„File"
usesThresholdForBlackAndWhiteScanningIndicates if this functional unit uses threshold value to be used when performing a scan in black & white.1

For scan area, please pass x, y, width and height as separate parameters.
Default folder for files is temporary folder.

Examples

Set scan area to physical size:

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 to US Letter format:

MBS("ImageCapture.SetParameter"; "documentType"; "USLetter")

Set document name:

MBS("ImageCapture.SetParameter"; "documentName"; "Scan")

Set resolution to 300 dpi:

MBS("ImageCapture.SetParameter"; "resolution"; 300)

Set to scan 8 bit RGB picture:

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

Set JPEG image type:

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

Use temporary folder for temp files:

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

Set scan area:

MBS( "ImageCapture.SetParameter"; "scanArea"; $x; $y; $w; $h )

Enable duplex:

MBS("ImageCapture.SetParameter"; "duplexScanningEnabled"; 1)

Set to A4 format:

MBS("ImageCapture.SetParameter"; "documentType"; "A4")

Switch to color or gray:

If [ $gray ]
    Set Variable [ $r ; Value: MBS("ImageCapture.SetParameter"; "bitDepth"; 8) ]
    Set Variable [ $r ; Value: MBS("ImageCapture.SetParameter"; "pixelDataType"; "Gray") ]
Else
    Set Variable [ $r ; Value: MBS("ImageCapture.SetParameter"; "bitDepth"; 8) ]
    Set Variable [ $r ; Value: MBS("ImageCapture.SetParameter"; "pixelDataType"; "RGB") ]
End If

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 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 [ 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

Set PNG image type:

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

See also

Example Databases

Created 11st September 2016, last changed 4th August 2018


ImageCapture.SetFeatureValue   -   ImageCapture.Thumbnail

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins