The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "IMAGESEARCH"
(→Notes) |
|||
(17 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
If the image is found then !IMAGEX and !IMAGEY hold the coordinates of where it was found. | If the image is found then !IMAGEX and !IMAGEY hold the coordinates of where it was found. | ||
− | === Syntax [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]]=== | + | === Syntax [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]=== |
− | IMAGESEARCH IMAGE=image_file CONFIDENCE=n [ALGORITHM= | + | IMAGESEARCH POS=<n> IMAGE=image_file CONFIDENCE=n [ALGORITHM=B/C/D] [FAIL=YES/NO] |
=== Parameters === | === Parameters === | ||
Line 16: | Line 16: | ||
*CONFIDENCE | *CONFIDENCE | ||
*:The confidence level, i.e. level of similarity between the input and the remote picture. Must between 1 and 100. Typically values between 40...100 give good and reliable results. | *:The confidence level, i.e. level of similarity between the input and the remote picture. Must between 1 and 100. Typically values between 40...100 give good and reliable results. | ||
− | *ALGORITHM (default if unspecified = B) | + | *ALGORITHM (default if unspecified = '''B''') |
*:Optional parameter to select the image recognition algorithm: | *:Optional parameter to select the image recognition algorithm: | ||
− | *:: | + | *::'''A''' No longer supported, it will fall back to '''B''' |
− | *:: | + | *::'''B''' general purpose algorithm: OpenCV 3 Template Matching. It should produce exactly the same result as in previous versions. |
− | *: | + | *::'''C''' faster than '''B''': OpenCV 3 Fast Template Matching |
− | *:Method B will be useful if your website or image changes color, as method B switches automatically to | + | *::'''D''' slightly more reliable than '''C''': OpenCV 3 Fast Template Matching with improved location of matches |
+ | *:We recommend method '''D''', but there will be cases when your image will be better found by '''C''', it is suggested to try both and find which one suits better your needs. Nevertheless, we left method '''B''' as default for compatibility with previous versions. Method '''B''' will be useful if your website or image changes color, as method '''B''' switches automatically to ''grey-scale mode'' when the confidence level is set to 90 or below, so color changes are ignored. | ||
+ | * FAIL (default if unspecified = NO) Available in iMacros 12 and later | ||
+ | *: Optional parameter to return an error if the image is found: | ||
+ | *:: If FAIL=YES is specified, the command will return error code -1850 when the image is found and halt any further retries. | ||
=== Notes === | === Notes === | ||
− | ''' | + | # [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]] IMAGESEARCH works in Firefox and Chrome only with one of iMacros editions which also support Image Validation (see the [[https://imacros.net/store/compare-versions/ Features Comparison Chart]] |
+ | # [[Image:Ff-icon.png|Firefox]] IMAGESEARCH currently does not find images in Flash apps in Firefox | ||
+ | # Older version of iMacros and ALGORITHM=A: The Microsoft Visual C++ runtime files required to support ALGORITHM=A are not shipped with current versions of iMacros (iMacros 8.03 up to 11.5). If you need to use ALGORITHM=A you can [http://download.imacros.net/archive/msvcrt90.zip download the runtime files here] and extract them to your C:\Program Files (x86)\Ipswitch\iMacros folder. This will enable ALGORITHM=A support in the iMacros browser only (it currently is not supported in iMacros for IE). | ||
+ | |||
+ | === FAQ === | ||
+ | |||
+ | '''Q:''' Can IMAGESEARCH find items "below the fold" (on the web page but not currently displayed in the browser window)? | ||
+ | |||
+ | '''A:''' Yes, but only in the iMacros browser and Firefox IMAGESEARCH works by scanning the entire web page, even the parts that aren't visible in the browser window. In IE and Chrome, the target image needs to be fully visible in the browser window for IMAGESEARCH to find it. | ||
+ | |||
'''Q:''' Is it possible to set the folder that the IMAGESEARCH command uses to load images from? It seems to default to: C:\Users\Public\Documents\iMacros\datasources\ | '''Q:''' Is it possible to set the folder that the IMAGESEARCH command uses to load images from? It seems to default to: C:\Users\Public\Documents\iMacros\datasources\ | ||
Line 32: | Line 45: | ||
* [[Distributing_iMacros#Edit_Paths|Change the default datasource folder]] | * [[Distributing_iMacros#Edit_Paths|Change the default datasource folder]] | ||
* Or, use the specific path directly in the command, e. g. IMAGESEARCH IMAGE=''d:\testimages\image1.png'' CONFIDENCE=100 | * Or, use the specific path directly in the command, e. g. IMAGESEARCH IMAGE=''d:\testimages\image1.png'' CONFIDENCE=100 | ||
− | |||
Revision as of 10:39, 11 August 2017
Searches for the input image specified via the IMAGE attribute. The input image is searched on the currently displayed website using Image Recognition algorithms. CONFIDENCE specifies how closely the found image must match the input image. A value of 100 means exact match. If the input image is not found at the given confidence level an error occurs.
If the image is found then !IMAGEX and !IMAGEY hold the coordinates of where it was found.
Syntax
IMAGESEARCH POS=<n> IMAGE=image_file CONFIDENCE=n [ALGORITHM=B/C/D] [FAIL=YES/NO]
Parameters
- POS
- Find the n-th image. Same as the POS attribute in TAG
- IMAGE
- The path to the image to be searched. Supported file formats are BMP and PNG. The smaller the input image, the faster the search.
- CONFIDENCE
- The confidence level, i.e. level of similarity between the input and the remote picture. Must between 1 and 100. Typically values between 40...100 give good and reliable results.
- ALGORITHM (default if unspecified = B)
- Optional parameter to select the image recognition algorithm:
- A No longer supported, it will fall back to B
- B general purpose algorithm: OpenCV 3 Template Matching. It should produce exactly the same result as in previous versions.
- C faster than B: OpenCV 3 Fast Template Matching
- D slightly more reliable than C: OpenCV 3 Fast Template Matching with improved location of matches
- We recommend method D, but there will be cases when your image will be better found by C, it is suggested to try both and find which one suits better your needs. Nevertheless, we left method B as default for compatibility with previous versions. Method B will be useful if your website or image changes color, as method B switches automatically to grey-scale mode when the confidence level is set to 90 or below, so color changes are ignored.
- Optional parameter to select the image recognition algorithm:
- FAIL (default if unspecified = NO) Available in iMacros 12 and later
- Optional parameter to return an error if the image is found:
- If FAIL=YES is specified, the command will return error code -1850 when the image is found and halt any further retries.
- Optional parameter to return an error if the image is found:
Notes
- IMAGESEARCH works in Firefox and Chrome only with one of iMacros editions which also support Image Validation (see the [Features Comparison Chart]
- IMAGESEARCH currently does not find images in Flash apps in Firefox
- Older version of iMacros and ALGORITHM=A: The Microsoft Visual C++ runtime files required to support ALGORITHM=A are not shipped with current versions of iMacros (iMacros 8.03 up to 11.5). If you need to use ALGORITHM=A you can download the runtime files here and extract them to your C:\Program Files (x86)\Ipswitch\iMacros folder. This will enable ALGORITHM=A support in the iMacros browser only (it currently is not supported in iMacros for IE).
FAQ
Q: Can IMAGESEARCH find items "below the fold" (on the web page but not currently displayed in the browser window)?
A: Yes, but only in the iMacros browser and Firefox IMAGESEARCH works by scanning the entire web page, even the parts that aren't visible in the browser window. In IE and Chrome, the target image needs to be fully visible in the browser window for IMAGESEARCH to find it.
Q: Is it possible to set the folder that the IMAGESEARCH command uses to load images from? It seems to default to: C:\Users\Public\Documents\iMacros\datasources\
A: There are two options
- Change the default datasource folder
- Or, use the specific path directly in the command, e. g. IMAGESEARCH IMAGE=d:\testimages\image1.png CONFIDENCE=100
Q: I would like to know how to change the number of retries for the image recognition feature.
A: You can do this with SET !TIMEOUT_STEP <x>
x = number of retries, default = 6 (one retry each second)
Examples
Example macro: Demo-ImageRecognition
See Also
Image Recognition, IMAGECLICK, DS, Which technologies are supported in tray/silent mode