Hello
i try to do the following:
reading several images and serch them (in a loop) the results shoud be afterwards in the passed variables wich have the loopnumber to identifiy them
i show here the code for one only to explain where is the problem
let>i=1
let>bmp2cmp=D:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,FEXArr%i%,{%i%YArr},{%i%NumFound}
i show here several style to try to invoke the new variablename, none of this works
i expected a variablename with the value of i inside instad the debugger watchwindow shos me the names as witten in the functioncall with % inside
What do i worng (or do i expect to much from this scriptinglanguage????) ????
Thx inn advange for all help
dj
composed variablenames for buildinfunction calls???
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 14
- Joined: Fri Aug 20, 2010 9:08 am
Try this:
Code: Select all
Let>i=1
Let>bmp2cmp=d:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
FindImagePos>bitmap_to_find,bitmap_to_scan|SCREEN,color_tolerance,return_center,X_Array,Y_Array,NumFound
Scans bitmap_to_scan looking for occurrences of bitmap_to_find. bitmap_to_find is usually a small image such as an image of a button or other GUI component captured at design time, and bitmap_to_scan would be a screen image or capture of a window taken at runtime with ScreenCapture.
bitmap_to_scan can be set to SCREEN to scan the screen directly, rather than a bitmap file.
If color_tolerance is zero the pixel colors must match exactly. color_tolerance can be set to a value between 0 and 255. If larger than zero the red, green and blue values of the pixels in bitmap_to_scan are checked to see if they are within the tolerance specified (color value + or - color_tolerance). Smaller values match less and larger values match more.
If return_center is 0 the returned coordinates are the starting position of the located image within bitmap_to_scan. In other words X, Y is the top left corner of bitmap_to_find within bitmap_to_scan. If return_center is 1 X,Y will be set to the center of the located image within the main bitmap_to_scan image.
X_Array is the name of a variable to store the X coordinates of each match. The first match is stored in X_Array_0, the second in X_Array_1, etc.
Y_Array is the name of a variable to store the Y coordinates of each match. The first match is stored in Y_Array_0, the second in Y_Array_1, etc.
NumFound returns the number of matches found.
-
- Newbie
- Posts: 14
- Joined: Fri Aug 20, 2010 9:08 am
i need compüosed variablenames
ok i know the standard example but it doesnt fullfill my needs
i want to loop througn several images and finde them all to avoid code like this:
[code]
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr1,YArr1,NumFound1
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr2,YArr2,NumFound2
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr3,YArr3,NumFound3
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr4,YArr5,NumFound4
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr5,YArr5,NumFound5
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr6,YArr6,NumFound6
[/code]
[code]
i´ll rather wanna do that:
let>i=0
repeat>i
FindImagePos>%bmp2cmp%%i%,SCREEN,20,1,XArr%i%,YArr%i%,NumFound%i%
add>i,1
Until>i=NUMLOOPS
[/code]
i can access thus variablenames later by Numfound%i% ill tried that with let u can create them , why the interpreter dont create them in a call ????
[quote="adroege"]Try this:
[code]
Let>i=1
Let>bmp2cmp=d:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
[/code]
[quote]FindImagePos>bitmap_to_find,bitmap_to_scan|SCREEN,color_tolerance,return_center,X_Array,Y_Array,NumFound
Scans bitmap_to_scan looking for occurrences of bitmap_to_find. bitmap_to_find is usually a small image such as an image of a button or other GUI component captured at design time, and bitmap_to_scan would be a screen image or capture of a window taken at runtime with ScreenCapture.
bitmap_to_scan can be set to SCREEN to scan the screen directly, rather than a bitmap file.
If color_tolerance is zero the pixel colors must match exactly. color_tolerance can be set to a value between 0 and 255. If larger than zero the red, green and blue values of the pixels in bitmap_to_scan are checked to see if they are within the tolerance specified (color value + or - color_tolerance). Smaller values match less and larger values match more.
If return_center is 0 the returned coordinates are the starting position of the located image within bitmap_to_scan. In other words X, Y is the top left corner of bitmap_to_find within bitmap_to_scan. If return_center is 1 X,Y will be set to the center of the located image within the main bitmap_to_scan image.
X_Array is the name of a variable to store the X coordinates of each match. [b]The first match is stored in X_Array_0, the second in X_Array_1, etc.[/b]
Y_Array is the name of a variable to store the Y coordinates of each match. [b]The first match is stored in Y_Array_0, the second in Y_Array_1, etc.
[/b]
NumFound returns the number of matches found.
[/quote][/quote]
i want to loop througn several images and finde them all to avoid code like this:
[code]
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr1,YArr1,NumFound1
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr2,YArr2,NumFound2
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr3,YArr3,NumFound3
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr4,YArr5,NumFound4
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr5,YArr5,NumFound5
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr6,YArr6,NumFound6
[/code]
[code]
i´ll rather wanna do that:
let>i=0
repeat>i
FindImagePos>%bmp2cmp%%i%,SCREEN,20,1,XArr%i%,YArr%i%,NumFound%i%
add>i,1
Until>i=NUMLOOPS
[/code]
i can access thus variablenames later by Numfound%i% ill tried that with let u can create them , why the interpreter dont create them in a call ????
[quote="adroege"]Try this:
[code]
Let>i=1
Let>bmp2cmp=d:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
[/code]
[quote]FindImagePos>bitmap_to_find,bitmap_to_scan|SCREEN,color_tolerance,return_center,X_Array,Y_Array,NumFound
Scans bitmap_to_scan looking for occurrences of bitmap_to_find. bitmap_to_find is usually a small image such as an image of a button or other GUI component captured at design time, and bitmap_to_scan would be a screen image or capture of a window taken at runtime with ScreenCapture.
bitmap_to_scan can be set to SCREEN to scan the screen directly, rather than a bitmap file.
If color_tolerance is zero the pixel colors must match exactly. color_tolerance can be set to a value between 0 and 255. If larger than zero the red, green and blue values of the pixels in bitmap_to_scan are checked to see if they are within the tolerance specified (color value + or - color_tolerance). Smaller values match less and larger values match more.
If return_center is 0 the returned coordinates are the starting position of the located image within bitmap_to_scan. In other words X, Y is the top left corner of bitmap_to_find within bitmap_to_scan. If return_center is 1 X,Y will be set to the center of the located image within the main bitmap_to_scan image.
X_Array is the name of a variable to store the X coordinates of each match. [b]The first match is stored in X_Array_0, the second in X_Array_1, etc.[/b]
Y_Array is the name of a variable to store the Y coordinates of each match. [b]The first match is stored in Y_Array_0, the second in Y_Array_1, etc.
[/b]
NumFound returns the number of matches found.
[/quote][/quote]
Try this:
It creates an array of X matches called XArray1,XArray2,etc
It creates an array of Y matches called YArray1,YArray2,etc
It creates an array of NumFound called NumFound1,NumFound2,etc
You can loop through and retrieve the values after the variables are created.
Code: Select all
Let>i=0
repeat>i
Let>i=i+1
Let>bmp2cmp=c:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
Let>XArray%i%=XArr_0
Let>YArray%i%=YArr_0
Let>NumFound%i%=NumFound
until>i,3
It creates an array of Y matches called YArray1,YArray2,etc
It creates an array of NumFound called NumFound1,NumFound2,etc
You can loop through and retrieve the values after the variables are created.
-
- Newbie
- Posts: 14
- Joined: Fri Aug 20, 2010 9:08 am
Hello,
seems your version save only the first entry for every array (xArr_0,Yarr_0) or am i wrong ?
regards
dj
[quote="adroege"]Try this:
[code]
Let>i=0
repeat>i
Let>i=i+1
Let>bmp2cmp=c:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
Let>XArray%i%=XArr_0
Let>YArray%i%=YArr_0
Let>NumFound%i%=NumFound
until>i,3
[/code]
It creates an array of X matches called XArray1,XArray2,etc
It creates an array of Y matches called YArray1,YArray2,etc
It creates an array of NumFound called NumFound1,NumFound2,etc
You can loop through and retrieve the values after the variables are created.[/quote]
seems your version save only the first entry for every array (xArr_0,Yarr_0) or am i wrong ?
regards
dj
[quote="adroege"]Try this:
[code]
Let>i=0
repeat>i
Let>i=i+1
Let>bmp2cmp=c:\test%i%.bmp
FindImagePos>%bmp2cmp%,SCREEN,20,1,XArr,YArr,NumFound
Let>XArray%i%=XArr_0
Let>YArray%i%=YArr_0
Let>NumFound%i%=NumFound
until>i,3
[/code]
It creates an array of X matches called XArray1,XArray2,etc
It creates an array of Y matches called YArray1,YArray2,etc
It creates an array of NumFound called NumFound1,NumFound2,etc
You can loop through and retrieve the values after the variables are created.[/quote]