ImageCapture.OpenDevice
-----------------------

Requests to open a session on the device.

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

MBS( "ImageCapture.OpenDevice"; Device { ; Wait } ) 

**MBS**( **"ImageCapture.OpenDevice";** /\* Requests to open a session on the device. \*/  
**$Device**; /\* The device ID.  
Can be zero based index in device list.  
Or UUID, Name or persistent ID string.e.g. 0 \*/   
**$Wait**) /\* Optional; Pass 1 to wait till complete.  
Or pass 0 to return immediately.  
Default is 1 to wait.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Device | The device ID.   Can be zero based index in device list.   Or UUID, Name or persistent ID string. | 0 |  |
| 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

Requests to open a session on the device.   
A client MUST open a session on a device in order to use the device.  
  
If needed closes current device to open new device.  
Added 20 seconds timeout for version 8.1.  
  
With [ImageCapture.DeviceInfo](ImageCaptureDeviceInfo.md) you can query hasOpenSession later to verify you have a session open.  
### Examples

Open device:

 Set Variable \[$r ; Value:MBS ("ImageCapture.OpenDevice"; Images::Device )\]  
If \[MBS ("iserror")\]  
 Show Custom Dialog \["Failed to open"; MBS ("[Text.RemovePrefix](TextRemovePrefix.md)"; $r ; "\[MBS \] ")\]  
 Exit Script \[\]  
End If  
### See also

- [ImageCapture.CloseDevice](ImageCaptureCloseDevice.md)
- [ImageCapture.DeviceInfo](ImageCaptureDeviceInfo.md)
- [ImageCapture.Devices](ImageCaptureDevices.md)
- [ImageCapture.RequestScan](ImageCaptureRequestScan.md)
- [ImageCapture.RequestSelectFunctionalUnit](ImageCaptureRequestSelectFunctionalUnit.md)
- [IsError](IsError.md)
- [Text.RemovePrefix](TextRemovePrefix.md)

### Release notes

- **Version 8.4**
    - Changed [ImageCapture.OpenDevice](http://www.mbsplugins.eu/ImageCaptureOpenDevice.shtml) and [ImageCapture.CloseDevice](http://www.mbsplugins.eu/ImageCaptureCloseDevice.shtml) to only request closing of the current session, if there is one open to avoid freeze.
- **Version 8.3**
    - Added wait parameter for [ImageCapture.CloseDevice](http://www.mbsplugins.eu/ImageCaptureCloseDevice.shtml), [ImageCapture.OpenDevice](http://www.mbsplugins.eu/ImageCaptureOpenDevice.shtml), [ImageCapture.RequestDeleteFiles](http://www.mbsplugins.eu/ImageCaptureRequestDeleteFiles.shtml), [ImageCapture.requestOverviewScan](http://www.mbsplugins.eu/ImageCapturerequestOverviewScan.shtml), [ImageCapture.requestScan](http://www.mbsplugins.eu/ImageCapturerequestScan.shtml) and [ImageCapture.requestSelectFunctionalUnit](http://www.mbsplugins.eu/ImageCapturerequestSelectFunctionalUnit.shtml) functions.
    - Changed [ImageCapture.OpenDevice](http://www.mbsplugins.eu/ImageCaptureOpenDevice.shtml) to wait for ready signal of device, so your scripts do not continue before we know all details of device.
- **Version 8.1**
    - Added timeout for [ImageCapture.OpenDevice](http://www.mbsplugins.eu/ImageCaptureOpenDevice.shtml) in case no answer comes from driver.

### Example Databases

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

### Blog Entries

- [Import images from cameras on MacOS with FileMaker](https://www.mbsplugins.de/archive/2020-08-28/Import_images_from_cameras_on_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.4pr6](https://www.mbsplugins.de/archive/2018-09-01/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.3pr3](https://www.mbsplugins.de/archive/2018-06-21/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.3pr2](https://www.mbsplugins.de/archive/2018-06-18/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin v8.1 with 5100 Functions In One Plugin](https://www.mbsplugins.de/archive/2018-03-06/MBS_FileMaker_Plugin_v81_with_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 8.1](https://www.mbsplugins.de/archive/2018-03-06/MBS_FileMaker_Plugin_81/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.1pr4](https://www.mbsplugins.de/archive/2018-02-20/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

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

This function checks for a license.

Created 11st September 2016 , last changed 18th April 2024

  
[ImageCapture.MediaFiles](ImageCaptureMediaFiles.md) - [ImageCapture.PDF](ImageCapturePDF.md)

[HTML Version](ImageCaptureOpenDevice.shtml)