ImageCapture.SetParameter
-------------------------

Sets a parameter for current scanner functional device.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [ImageCapture](component_ImageCapture.md) | [6.4](newinversion64.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

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

**MBS**( **"ImageCapture.SetParameter";** /\* Sets a parameter for current scanner functional device. \*/  
**$Selector**; /\* The value to set.e.g. "documentName" \*/   
**$Value**) /\* The value to set. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| 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.  
  
| Selector | Description | Example |
|---|---|---|
| bitDepth | The bit depth to use when performing the final scan. This will always be one of the supported bit depths. | 8 |
| documentName | The document name. | „Scan" |
| documentType | Current document type. | „A4" |
| documentUTI | The document UTI. Can be set using JPEG, JPEG2000, PDF, TIFF or PNG. | „JPEG" |
| downloadsDirectory | The downloads directory. If you pass „temp", we use the user’s temp folder. | „/Users/cs/Desktop" |
| maxMemoryBandSize | The total maximum band size requested when performing a memory based transfer. |  |
| measurementUnit | Current measurement unit. Can be Inches, Centimeters, Picas, Points, Twips or Pixels. | „Inches" |
| overviewResolution | Overview image resolution. Value assigned to this will be constrained by resolutions allowed by the device. |  |
| resolution | Current scan resolution. This will always be one of the supported resolution values. | 300 |
| thresholdForBlackAndWhiteScanning | Threshold value to be used when performing a scan in black &amp; white. This value should be from 0 to 255. | 127 |
| transferMode | The transfer mode for scanned document. Can be File or Memory, but Plugin only supports File. | „File" |
| usesThresholdForBlackAndWhiteScanning | Indicates if this functional unit uses threshold value to be used when performing a scan in black &amp; white. | 1 |
| duplexScanningEnabled | Indicates whether duplex scanning is enabled. | 1 |
| scaleFactor | Current scale factor. This will always be one of the supported scale factor values. | 100 |
| pixelDataType | The pixel data type. Can be BW, Gray, RGB, Palette, CMY, CMYK, YUV, YUVK or CIEXYZ. | "RGB" |
| scanAreaOrientation | Desired orientation of the scan area. This property along with scanArea describes the area to be scanned. 1 for Normal, 2 Flipped horizontally, 3 Rotated 180°, 4 Flipped vertically, 5. Rotated 90° CCW and flipped vertically, 6 Rotated 90° CCW, 7 Rotated 90° CW and flipped vertically, 8 Rotated 90° CW. | 1 |
| oddPageOrientation | Desired orientation of the odd pages of the scanned document. | 1 |
| evenPageOrientation | Desired orientation of the even pages of the scanned document. | 1 |
| scanArea | Pass 4 parameters with X, Y, Width and Height to define scan. |  |

  
For scan area, please pass x, y, width and height as separate parameters.  
Default folder for files is temporary folder.  
  
List of valid document types: Default, A4, B5, USLetter, USLegal, A5, ISOB4, ISOB6, USLedger, USExecutive, A3, ISOB3, A6, C4, C5, C6, 4A0, 2A0, A0, A1, A2, A7, A8, A9, 10, ISOB0, ISOB1, ISOB2, ISOB5, ISOB7, ISOB8, ISOB9, ISOB10, JISB0, JISB1, JISB2, JISB3, JISB4, JISB6, JISB7, JISB8, JISB9, JISB10, C0, C1, C2, C3, C7, C8, C9, C10, USStatement, BusinessCard, E, 3R, 4R, 5R, 6R, 8R, S8R, 10R, S10R, 11R, 12R, S12R, 110, APSH, APSC, APSP, 135, MF, LF.  
### Examples

Set scan area to physical size:

 Set Variable \[$physicalWidth ; Value:MBS ("[ImageCapture.GetParameter](ImageCaptureGetParameter.md)"; "physicalWidth")\]  
Set Variable \[$physicalHeight ; Value:MBS ("[ImageCapture.GetParameter](ImageCaptureGetParameter.md)"; "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](ImageCaptureGetParameter.md)"; "physicalWidth") \]   
Set Variable \[ $physicalHeight ; Value: MBS ("[ImageCapture.GetParameter](ImageCaptureGetParameter.md)"; "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](ProgressDialogReset.md)") \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.SetTitle](ProgressDialogSetTitle.md)"; "Scanning" ) \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.SetBottomText](ProgressDialogSetBottomText.md)"; "" ) \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.SetTopText](ProgressDialogSetTopText.md)"; "Scan from Flatbed scanner." ) \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.SetButtonCaption](ProgressDialogSetButtonCaption.md)"; "Cancel" ) \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.SetProgress](ProgressDialogSetProgress.md)"; -1 ) \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.Show](ProgressDialogShow.md)" ) \]   
Set Variable \[ $r ; Value: MBS ("[ImageCapture.RequestScan](ImageCaptureRequestScan.md)") \]   
Set Variable \[ $p ; Value: MBS ("[ProgressDialog.Hide](ProgressDialogHide.md)" ) \]   
If \[ MBS ("iserror") \]   
 Show Custom Dialog \[ "Failed start scan" ; MBS ("[Text.RemovePrefix](TextRemovePrefix.md)"; $r ; "\[MBS \] ") \]   
 Exit Script \[ Text Result: \]   
End If  
\#   
\# read images   
Pause/Resume Script \[ Duration (seconds): ,1 \]   
Set Variable \[ $Paths ; Value: MBS ("[ImageCapture.ImagePaths](ImageCaptureImagePaths.md)") \]   
If \[ Length ( $Paths ) &gt; 0 \]   
 Set Variable \[ $Count ; Value: ValueCount ( $Paths ) \]   
 If \[ $Count &gt; 0 \]   
 Set Variable \[ $Index ; Value: 1 \]   
 Loop  
 Set Variable \[ $Path ; Value: GetValue($Paths ; $index ) \]   
 New Record/Request  
 Set Field \[ Images::Image ; MBS ("[Container.ReadFile](ContainerReadFile.md)"; $path ) \]   
 Set Variable \[ $r ; Value: MBS ( "[Files.Delete](FilesDelete.md)"; $Path ) \]   
 Commit Records/Requests \[ With dialog: Off \]   
 Set Variable \[ $Index ; Value: $index + 1 \]   
 Exit Loop If \[ $index &gt; $count \]   
 End Loop  
 End If  
End If  
Set PNG image type:

 Set Variable \[$r ; Value:MBS ("ImageCapture.SetParameter"; "documentUTI"; "png")\]  
Set to scan black and white picture:

 Set Variable \[$r ; Value:MBS ("ImageCapture.SetParameter"; "bitDepth"; 1)\]  
Set Variable \[$r ; Value:MBS ("ImageCapture.SetParameter"; "pixelDataType"; "BW")\]  
Set PDF image type:

 Set Variable \[$r ; Value:MBS ("ImageCapture.SetParameter"; "documentUTI"; "pdf")\]  
### See also

- [ImageCapture.GetParameters](ImageCaptureGetParameters.md)
- [ImageCapture.RequestScan](ImageCaptureRequestScan.md)
- [ProgressDialog.Hide](ProgressDialogHide.md)
- [ProgressDialog.SetBottomText](ProgressDialogSetBottomText.md)
- [ProgressDialog.SetButtonCaption](ProgressDialogSetButtonCaption.md)
- [ProgressDialog.SetProgress](ProgressDialogSetProgress.md)
- [ProgressDialog.SetTitle](ProgressDialogSetTitle.md)
- [ProgressDialog.SetTopText](ProgressDialogSetTopText.md)
- [ProgressDialog.Show](ProgressDialogShow.md)
- [Text.RemovePrefix](TextRemovePrefix.md)

### Release notes

- **Version 10.0**
    - Changed [ImageCapture.GetParameter](https://www.mbsplugins.eu/ImageCaptureGetParameter.shtml) and [ImageCapture.SetParameter](https://www.mbsplugins.eu/ImageCaptureSetParameter.shtml) to return an error if you try to set parameter of a functional unit, but none is selected.

### Example Databases

- [Mac only/ImageCapture/ImageCapture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/ImageCapture/ImageCapture.shtml#6ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 9.6pr3](https://www.mbsplugins.de/archive/2019-12-17/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.5pr7](https://www.mbsplugins.de/archive/2016-11-16/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [ImageCapture functions for Mac OS X](https://www.mbsplugins.de/archive/2016-09-12/ImageCapture_functions_for_Mac/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2022, Seite 15 bis 16](https://filemaker-magazin.de/neuigkeit/4206-Appetithappen-FMM_202206)

This function checks for a license.

Created 11st September 2016 , last changed 22nd November 2022

  
[ImageCapture.SetItemsAddedScript](ImageCaptureSetItemsAddedScript.md) - [ImageCapture.Thumbnail](ImageCaptureThumbnail.md)

[HTML Version](ImageCaptureSetParameter.shtml)