Twain.Acquire
-------------

Acquires a picture.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Twain](component_Twain.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Twain.Acquire" { ; Modal; ShowUI; BringWindowToFront } ) 

**MBS**( **"Twain.Acquire";** /\* Acquires a picture. \*/  
**$Modal**; /\* Optional; Whether to run the process modal. Default is 0 for running non modal.  
Ignored in most cases.e.g. 0 \*/   
**$ShowUI**; /\* Optional; Whether to show the dialog. Pass 1 to show dialog or 0 to not show it. Default is 1.e.g. 1 \*/   
**$BringWindowToFront**) /\* Optional; For Windows only a flag.  
Pass 1 to have the plugin watch for new windows and bring them to front and avoid them showing behind FileMaker’s windows.  
Default 0.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Modal | Whether to run the process modal. Default is 0 for running non modal.   Ignored in most cases. | 0 | Optional |
| ShowUI | Whether to show the dialog. Pass 1 to show dialog or 0 to not show it. Default is 1. | 1 | Optional |
| BringWindowToFront | For Windows only a flag.   Pass 1 to have the plugin watch for new windows and bring them to front and avoid them showing behind FileMaker’s windows.   Default 0. | 1 | Optional |

### Result

Returns OK or the Twain error code.

### Description

Acquires a picture.  
The acquire process will go asynchronously. You can define a script with [Twain.SetNotificationScript](TwainSetNotificationScript.md) to be called when transfers are done. If you acquire without UI, you can make script pause to let the acquire work and check with [Twain.GetImageCount](TwainGetImageCount.md) function whether images have been received.  
Even when using no UI, you can pass Modal = 1 to have the plugin transfer the image right after acquire without waiting for an event from twain driver.  
### Examples

Acquire with UI, window to front and modal:

 MBS ( "Twain.Acquire"; 1; 1; 1)  
### See also

- [Twain.GetFilePaths](TwainGetFilePaths.md)
- [Twain.GetImageCount](TwainGetImageCount.md)
- [Twain.SetAutofeed](TwainSetAutofeed.md)
- [Twain.SetCloseAfterTransfer](TwainSetCloseAfterTransfer.md)
- [Twain.SetFeededEnabled](TwainSetFeededEnabled.md)
- [Twain.SetNotificationScript](TwainSetNotificationScript.md)
- [Twain.SetPixelType](TwainSetPixelType.md)

### Release notes

- **Version 14.5**
    - Fixed an issue with [GMImage.WriteToPDFContainer](https://www.mbsplugins.eu/GMImageWriteToPDFContainer.shtml) and [Twain.Acquire](https://www.mbsplugins.eu/TwainAcquire.shtml) on Windows.
- **Version 11.4**
    - Fixed problem in [Twain.Acquire](https://www.mbsplugins.eu/TwainAcquire.shtml) to fail better if we can't open the data source.
- **Version 7.2**
    - Added BringWindowToFront parameter to [Twain.Acquire](http://www.mbsplugins.eu/TwainAcquire.shtml) function.

### Example Databases

- [Mac and iOS/PDFKit/Pictures to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Pictures%20to%20PDF.shtml#4ScriptAnchor_)
- [Win Only/Scanning/Twain](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Scanning/Twain.shtml#8ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 14.5pr1](https://www.mbsplugins.de/archive/2024-10-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.4pr4](https://www.mbsplugins.de/archive/2021-08-30/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.2pr6](https://www.mbsplugins.de/archive/2017-05-11/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin for iOS Update](https://www.mbsplugins.de/archive/2017-05-11/MBS_FileMaker_Plugin_for_iOS_U/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 9th May 2017

  
[Translation.Translations](TranslationTranslations.md) - [Twain.ClearCancelScript](TwainClearCancelScript.md)

[HTML Version](TwainAcquire.shtml)