WIA.SetDevicePropertyValue
--------------------------

Sets a device property value.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WIA](component_WIA.md) | [6.5](newinversion65.md) | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "WIA.SetDevicePropertyValue"; Device; Key; Value { ; Type } ) 

**MBS**( **"WIA.SetDevicePropertyValue";** /\* Sets a device property value. \*/  
**$Device**; /\* You can pass index of device to check them in a row.  
Or pass name or unique ID of device.  
Pass empty string for current device.e.g. "" \*/   
**$Key**; /\* The property key.e.g. "Horizontal Resolution" \*/   
**$Value**; /\* The value to use.e.g. 300 \*/   
**$Type**) /\* Optional; The data type to use.  
By default if empty or auto, we detect it based on the type of the existing property.  
Can be Boolean, Int16, Int32, Int64, UInt16, UInt32, UInt64, String or Double.   
Added GUID and CLSID as type for v12.1.e.g. "Int32" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Device | You can pass index of device to check them in a row.   Or pass name or unique ID of device.   Pass empty string for current device. | "" |  |
| Key | The property key. | "Horizontal Resolution" |  |
| Value | The value to use. | 300 |  |
| Type | The data type to use.   By default if empty or auto, we detect it based on the type of the existing property.   Can be Boolean, Int16, Int32, Int64, UInt16, UInt32, UInt64, String or Double.    Added GUID and CLSID as type for v12.1. | "Int32" | Optional |

### Result

Returns OK or error.

### Description

Sets a device property value.  
You can use [WIA.DevicePropertyKeys](WIADevicePropertyKeys.md) to learn about available keys.  
  
To learn about properties you may need to visit Microsoft websites and figure out the options and the values for the listed constants:  
<https://msdn.microsoft.com/en-us/library/windows/desktop/ms630196(v=vs.85).aspx>  
  
Page sizes are listed here:  
<https://msdn.microsoft.com/en-us/library/aa360096(v=VS.85).aspx>  
  
Please query with [WIA.DeviceProperties](WIADeviceProperties.md) to see what keys and values are possible. You may want to query before and after setting the value via dialog.  
### Examples

Set to scan all pages:

 MBS ( "WIA.SetDevicePropertyValue"; ""; 3096; 0)  
Set media type to file:

 MBS ( "WIA.SetDevicePropertyValue"; ""; "Media Type"; 2)  
Set page size to A4:

 MBS ( "WIA.SetDevicePropertyValue"; ""; "Page Size"; 0)  
Request feeder with duplex:

 MBS ( "WIA.SetDevicePropertyValue"; ""; "Device Handling Document"; 5 ) // 1 for feeder + 4 for duplex  
Request to keep one page in memory:

 MBS ( "WIA.SetDevicePropertyValue"; ""; "Pages"; 1 ) // keep one page in memory  
### See also

- [WIA.DeviceProperties](WIADeviceProperties.md)
- [WIA.DevicePropertyKeys](WIADevicePropertyKeys.md)
- [WIA.DevicePropertyValue](WIADevicePropertyValue.md)
- [WIA.SetItemPropertyValue](WIASetItemPropertyValue.md)

### Release notes

- **Version 12.1**
    - Added GUID (or CLSID) as type for [WIA.SetDevicePropertyValue](https://www.mbsplugins.eu/WIASetDevicePropertyValue.shtml) and [WIA.SetItemPropertyValue](https://www.mbsplugins.eu/WIASetItemPropertyValue.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 12.1pr4](https://www.mbsplugins.de/archive/2022-02-22/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 10th November 2016 , last changed 18th February 2022

  
[WIA.SetCurrentDevice](WIASetCurrentDevice.md) - [WIA.SetItemPropertyValue](WIASetItemPropertyValue.md)

[HTML Version](WIASetDevicePropertyValue.shtml)