Image - Image Recognition

Declaration

<AMIMAGE ACTIVITY="image_recognize" SUBFOLDERS="YES/NO" 
MATCHCASE="YES/NO" EXCLUDE="text" RE="YES/NO" 
HAYSTACKIMAGE="text" POSITION="text (options)" 
TOLERANCE="number" DATASET="text" NEEDLEIMAGE="text" />

Description: Scans one or more haystack (larger) images for occurrence of a matching needle (smaller) image and populates a dataset with results. To specify more than one file, use wildcard characters (e.g., * or ?). To specify multiple file names or wildcard masks, separate them with a pipe symbol (e.g., c:\*.txt|c:\*.bak).

Practical Usage

This activity can be used to quickly search for duplicate images within folders and sub-folders that may contain a considerable amount of image files.

General Parameters

Property

Type

Required

Default

Markup

Description

Haystack image

Text

Yes

(Empty)

  1. HAYSTACKIMAGE="c:\folderName\fileName.png"

  2. HAYSTACKIMAGE="c:\folderName\*.bmp"

  3. HAYSTACKIMAGE="c:\folder1\*.jpg|c:\folder2\*.gif"

The path of the folder(s) or file(s) to scan. This can be a fully qualified path and file name (preferred) or a folder/file name only. Wildcard characters (e.g., * or ?) can be used to specify files matching a certain mask. Multiple file names and/or file masks can be specified by separating each entry with a pipe (|) symbol (e.g., c:\*.txt|c:\*.bak).

Needle image

Text (options)

No

Existing PDF

NEEDLEIMAGE="C:\folderName\image.jpg"

The path and file name of the needle (smaller) image.

Tolerance

Number (options)

No

0

TOLERANCE="10"

The level of tolerance (accuracy) to apply when searching for matching images. Use the slider to select a tolerance value from 0 to 100 or enter the value manually in the provided text box. The default value is 0 tolerance which means pixel colors must match exactly.

Create and populate dataset

Text

Yes

(Empty)

DATASET="theDatasetName"

The name of the dataset to create and populate with results of this activity's performance.

Pixel position

Text (options)

No

Center

  1. POSITION="center"

  2. POSITION="top_left"

Determines the area of the matching needle image to reference when determining pixel coordinates. The available options are:

  • Center (default)- X and Y pixel coordinates will reference the center of the matching needle image within the main haystack image.

  • Top left- X and Y pixel coordinates will reference the top left corner of the matching needle image.

On completion

Text (options)

Yes if Use parameter set to Existing PDF

Do not save changes

SAVETYPE="do_not_save"

Specifies what this activity should do upon its completion. This parameter is active only if the Use parameter is set to Existing PDF. The available options are:

  • Do not save changes (default) - Any changes made to the existing PDF document will not be saved.

  • Save - Changes will be saved to the existing PDF document's default location and file name.

  • Save As - Allows changes to be saved to a new file name and/or location.

Destination PDF

Text

Yes if On Completion parameter is set to Save Changes

(Empty)

DESTINATION="C:\PDFFileName.pdf"

The new file name and/or location in which to save a copy of the original PDF file. This parameter is active only if the On Completion parameter is set to Save As.

File Options Parameters

Property

Type

Required

Default

Markup

Description

Include sub-folders

Yes/No

No

No

SUBFOLDERS="YES"

If set to YES, denotes that, if present, sub-folders should be searched for files matching the mask specified in the Source parameter. If set to NO (default), sub-folders are ignored. Only files that exist in the root of the source folder will be searched.

Preserve folder structure

Yes/No

No

Yes

KEEPFOLDERSTRUCT="NO"

If set to YES (default), sub-folders found in the source folder will be created in the destination folder and source files will be copied into their respective folders. If set to NO, sub-folders will not be created. Files that exist in these sub-folders will be copied into the root of the source folder instead. This parameter is active only if the Include Sub-folders parameter is set to YES.

Include empty sub-folders

Yes/No

No

No

EMPTYFOLDERS="YES"

If set to YES, sub-folders found in the source folder will be created in the destination folder even if they do not contain any files. If set to NO (default), empty sub-folders are ignored. This parameter is active only if the Include Sub-folders parameter is set to YES.

Only folder structure

Yes/No

No

No

ONLYFOLDERSTRUCT="YES"

If set to YES, sub-folders found in the source folder will be created in the destination folder but files that reside in these sub-folders will not be copied. This parameter is set to NO by default and is active only if the Include Sub-folders parameter is set to YES.

Note: Setting this parameter to YES causes all other folder-specific parameters to be ignored.

Overwrite if Exist

Yes/No

No

No

OVERWRITE="YES"

If set to YES, matching files found in the destination folder are to be overwritten. If set to NO (default), an error will occur as a result of a matching file found.

Only if Newer

Yes/No

No

No

ISNEWER="YES"

If set to YES, only source files that are newer than those that match in the destination are to be overwritten folder will overwrite existing files. If set to NO (default), all matching files found in the destination folder will be overwritten regardless of their date properties. This parameter is active only if the Overwrite if Exists parameter is set to YES.

Only if exist in destination

Yes/No

No

No

ONLYIFEXIST="YES"

If set to YES, only files that already exist in the destination folder will be copied from the source folder. All other files, regardless of whether they match the mask or other parameter settings will be bypassed. This parameter is set to NO by default and becomes active only if the Overwrite if Exist parameter is set to YES.

Overwrite read-only files

Yes/No

No

No

OVERWRITEREADONLY="YES"

If set to YES, matching files found in the destination folder will be overwritten even if they are marked with the read-only attribute. If set to NO (default), read-only files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

Overwrite hidden files

Yes/No

No

No

OVERWRITEHIDDEN="YES"

If set to YES, matching files found in the destination folder will be overwritten even if they are marked with the hidden attribute. If set to NO (default), hidden files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

Turn archive attribute off

Yes/No

No

No

ARCHIVETURNOFF="YES"

If set to YES, archive attribute of the source files will be switched OFF. The Windows archive attribute is generally used to track whether a file has been backed-up. Turning the source file's archive attribute off indicates to many backup programs that the file has already been backed-up. This parameter is set to NO by default.

Exclude mask

Text

No

(Empty)

EXCLUDE="*.txt"

Causes this action to omit files matching the mask(s) specified. File names or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Only if newer than

Date

No

(Empty)

ISNEWERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

If enabled, causes this action to only act on files that are newer than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored.

Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

Only if older than

Date

No

(Empty)

ISOLDERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

If enabled, causes this action to only act on files that are older than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored.

Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

File Filter Parameters

Property

Type

Required

Default

Markup

Description

Attributes

Text (Options)

No

(Empty)

ATTRFILTER="+R+A-H" (copy read-only & archive files but not hidden files)

These settings causes the activity to filter which files are affected by the attribute change based on the original attribute settings of the source file(s). In visual mode, a group of controls are provided to assist in the selection of this parameter. In AML mode, a single text item must be specified that contains the original attribute mask of the files you wish to affect. The available options are:

  • R—Read-only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • A—Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • S—System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • H—Hidden: Specifying "+R" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • C—Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Datasets

A dataset is a multi-column, multi-row object that contains a collection of information gathered during execution of a particular activity and stored in memory. This activity creates and populates a dataset with the following fields (rows):

Name

Type

Return Value

theDataset.Haystack

Text

The path and file name of the haystack image.

theDataset.HaystackHeight

Number

The height of the haystack image measured in pixels.

theDataset.HaystackWidth

Number

The width of the haystack image measured in pixels.

theDataset.IsFound

True/False

Returns TRUE if the haystack image was found. Otherwise, returns FALSE.

theDataset.Needle

Text

The path and file name of the needle image.

theDataset.NeedleHeight

Number

The height of the needle image measured in pixels.

theDataset.NeedleWidth

Number

The width of the needle image measured in pixels.

theDataset.X

Number

The X coordinates of a matching image.

theDataset.Y

Number

The Y coordinates of a matching image.

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Get properties of Active Directory object at ""LDAP://OU=MyCompany,DC=mycompany,DC=com"" and create and populate dataset "theDataset" with the properties.

<AMCREATEADPROPERTYDATASET LDAPPATH="&quot;LDAP://OU=MyCompany,DC=mycompany,DC=com&quot;" 
		 USERNAME="theUserName" PASSWORD="AM2PBmOg3vfcdsoGZuDe99x2" 
		 RESULTDATASET="theDataset" />