Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

WIA.ImageDialog

Offer dialog to user to acquire image.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
WIA 6.5 No Yes No No No

MBS( "WIA.ImageDialog"; Flags; FolderPath { ; FileName } )

Parameters

Parameter Description Example value
Flags Specifies dialog box behavior.
Currently only UseCommonUI is availlable. Use this flag to use the system UI instead of the vendor-supplied UI.
"UseCommonUI"
FolderPath The native path to the folder where images are stored.
Your application must have write permissions for this folder.
"C:\Scans\"
FileName Optional
The file name ot use.
Extensions and/or numbers are added if needed.
"Scan"

Result

Returns Cancel, OK or error.

Description

Offer dialog to user to acquire image.
This may ask the user for the device to use.
If a current device is selected, this one will be used.

When the functions returns, you can use WIA.ImageCount to query how many images got scanned.
Even if the user cancels, there may be some images already available.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.

Examples

Show image dialog:

Set Variable [$folder; Value:MBS( "Folders.UserTemporary" )]
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; $folder; "FileMakerScans")]
Set Variable [$r; Value:MBS( "Files.CreateDirectory"; $path)]
#Scan...
Set Variable [$r; Value:MBS("WIA.ImageDialog"; "Default"; $path; "scan")]
Set Variable [$count; Value:MBS( "WIA.ImageCount")]
#Result can be OK or Cancel and in both cases some images may be there
If [$r ≠ "OK"]
    Show Custom Dialog ["Scan Result"; $r]
End If
If [$count > 0]
    Set Variable [$i; Value:0]
    Go to Layout [“Images” (Images)]
    Loop
        Set Variable [$ImagePath; Value:MBS( "WIA.Image"; $i)]
        Set Variable [$image; Value:MBS( "Container.ReadFile"; $ImagePath)]
        New Record/Request
        Set Field [Images::Name; MBS( "Path.LastPathComponent"; $ImagePath )]
        Set Field [Images::Image; $image]
        Commit Records/Requests [No dialog]
        #Next
        Set Variable [$i; Value:$i + 1]
        Exit Loop If [$i >= $count]
    End Loop
End If

See also

Example Databases


WIA.ImageCount   -   WIA.Initialize

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins