Forum | | | | - Page 1 - |
| Christian Schneider | Hi,
I stand unfortunately time again on Kriegsfuß with of/ one .dll. this time is it The AutoItX3.dll. i want The function AU3_PixelSearch Call. CompileMarkSeparation How should now the suitable appeal looks? The Doku says:
AU3_API void WINAPI AU3_PixelSearch(long nLeft, long nTop, long nRight, long nBottom, long nCol, /*default 0*/long nVar, /*default 1*/long nStep, LPPOINT pPointResult);
I come simply not further. Dll and Help hang on the Posting on.
Greeting Christian |
| | | | |
| | | | | - Page 3 - |
| Thomas Freier | No, I had forgotten. now goes it and right zügig (17.5MB). would be however whom first weissen Pixel on another place suppose, z.B.: with whom Sonnenschirmen. Reduced example. Fundort is identical x=609, y=398. |
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 02/25/09 ▲ |
| |
| | Christian Schneider | RGH
Hi,
On what relating the Coordinates, in them sought becomes? relating which on the Desktop, irgenein Window, irgenmdeine Bitmap, or what integrally other?
I suspect time on the Desktop. of course there in AutoIt self with the function a optionalen Parameter for a lever, however standing this in the .dll apparently not available (at least not in the function self / Notes on a Einstellmöglichkeit by another function could I ditto not find).
RGH
there The DLL, How supra written standing, evident initialized go must, must tappt im dunkeln naturally too zuallererst with UseDLL into memory loaded go. is tappt im dunkeln this not, would tappt im dunkeln of course when calling the Init-function into WinXP? loaded, The function carryed out, but subsequently immediate again entladen will be. then would The Initialisierung for Katz!
I must confess the was me yet not deliberate. have already a little bit on this Base herumprobiert, however with the equal Result How yet.
RGH
i'd suppose, that to the appeal of AU3_PixelSearch first others Aufrufe erfolgen must, so what there's, in the sought go can.
How supra written could I hereon none Info find. of course there some Options everybody can by AutoItSetOption settle could, however nothing what really fit. Also is always one Default-worth present. |
| | | | |
| | | I had forget a code [...] To post. |
| | | | |
| | Christian Schneider | thanks. same time reading. |
| | | | |
| | Christian Schneider | The code runs by me in the Originalzustand without Problems.
now goes it me therefore several Farbvorkommen to find (if present). but this is not the eigentliche trouble. can someone begreiflich make Why the following 1. code runs and the 2. not?
1: CompileMarkSeparationCLS
var HPIC&=CREATE(hNewPic,1024,1024,0)
var X&=RND(1024)
var Y&=RND(1024)
var COL&=$00FF00
STARTPAINT HPIC&
SETPIXEL X&,Y&,COL&
ENDPAINT
Declare SOMEPOS&
SOMEPOS&=HPIC.PIXELSEARCH(HPIC&,COL&,1024,1024)
SOMEPOS&=HPIC.PIXELSEARCH(HPIC&,COL&,1024,1024)
PRINT X&,Y&
PRINT HIWORD(SOMEPOS&),LOWORD(SOMEPOS&)
WAITINPUT
END
proc HPIC.BGR2STRING
PARAMETERS H&,_WIDTH&,_HEIGHT&
var SZ&=( (_WIDTH&*328-1) | 3 +1) * ABS(_HEIGHT&)
DECLARE MEM#
DIM MEM#,BITMAPINFOHEADER
WITH MEM#
.BISIZE&=SIZEOF(MEM#)
.BIWIDTH&=_WIDTH&
.BIHEIGHT&=_HEIGHT&
.BIPLANES%=1
.BIBITCOUNT%=32
.BICOMPRESSION&=0
.BISIZEIMAGE&=SZ&
ENDWITH
DECLARE DATA#
DIM DATA#,SZ&
var RET$=
IF ~GetDIBits(%HDC,H&,0,_HEIGHT&,DATA#,MEM#,0)
RET$=CHAR$(DATA#,0,SZ&)
ENDIF
DISPOSE DATA#
DISPOSE MEM#
RETURN +RET$
endproc
proc HPIC.PIXELSEARCH
PARAMETERS H&,COLORTOFIND&,_WIDTH&,_HEIGHT&
var RAWDATA$=HPIC.BGR2STRING(H&,_WIDTH&,_HEIGHT&)
var _FND&=HPIC.FINDCOLORINRAWDATA(COLORTOFIND&,RAWDATA$)
IF _FND&=-1
RETURN _FND&
ENDIF
var X&=_FND& MOD _WIDTH&
var Y&=0
IF _FND& > 0
Y&=_FND&\_WIDTH&
ENDIF
RETURN X&*65536+(_HEIGHT&-Y&-1)
endproc
proc HPIC.FINDCOLORINRAWDATA
PARAMETERS COL&,DATA$
var C&=1
var P&=0
var SCOL$=CHR$(GETBVALUE(COL&))+CHR$(GETGVALUE(COL&))+CHR$(GETRVALUE(COL&))
WHILE 1
P&=INSTR(SCOL$,DATA$,C&)
IFNOT P&
BREAK
ENDIF
IFNOT (P&-1) MOD 4
RETURN P&*0.25
ENDIF
C&=P&+1
ENDWHILE
RETURN - span class=s2>1
endproc
2: CompileMarkSeparation $H windows.ph
STRUCT BITMAPINFOHEADER=BISIZE&,BIWIDTH&,BIHEIGHT&,BIPLANES%,BIBITCOUNT%,BICOMPRESSION&,BISIZEIMAGE&,BIXPELSPERMETER&,BIYPELSPERMETER&,BICLRUSED&,BICLRIMPORTANT&
RANDOMIZE
CLS
var HPIC&=CREATE(hNewPic,1024,1024,0)
var X&=RND(1024)
var Y&=RND(1024)
var COL&=$00FF00
STARTPAINT HPIC&
SETPIXEL X&,Y&,COL&
ENDPAINT
Declare SOMEPOS&
Whileloop 2
SOMEPOS&=HPIC.PIXELSEARCH(HPIC&,COL&,1024,1024)
Endwhile
PRINT X&,Y&
PRINT HIWORD(SOMEPOS&),LOWORD(SOMEPOS&)
WAITINPUT
END
proc HPIC.BGR2STRING
PARAMETERS H&,_WIDTH&,_HEIGHT&
var SZ&=( (_WIDTH&*328-1) | 3 +1) * ABS(_HEIGHT&)
DECLARE MEM#
DIM MEM#,BITMAPINFOHEADER
WITH MEM#
.BISIZE&=SIZEOF(MEM#)
.BIWIDTH&=_WIDTH&
.BIHEIGHT&=_HEIGHT&
.BIPLANES%=1
.BIBITCOUNT%=32
.BICOMPRESSION&=0
.BISIZEIMAGE&=SZ&
ENDWITH
DECLARE DATA#
DIM DATA#,SZ&
var RET$=
IF ~GetDIBits(%HDC,H&,0,_HEIGHT&,DATA#,MEM#,0)
RET$=CHAR$(DATA#,0,SZ&)
ENDIF
DISPOSE DATA#
DISPOSE MEM#
RETURN +RET$
endproc
proc HPIC.PIXELSEARCH
PARAMETERS H&,COLORTOFIND&,_WIDTH&,_HEIGHT&
var RAWDATA$=HPIC.BGR2STRING(H&,_WIDTH&,_HEIGHT&)
var _FND&=HPIC.FINDCOLORINRAWDATA(COLORTOFIND&,RAWDATA$)
IF _FND&=-1
RETURN _FND&
ENDIF
var X&=_FND& MOD _WIDTH&
var Y&=0
IF _FND& > 0
Y&=_FND&\_WIDTH&
ENDIF
RETURN X&*65536+(_HEIGHT&-Y&-1)
endproc
proc HPIC.FINDCOLORINRAWDATA
PARAMETERS COL&,DATA$
var C&=1
var P&=0
var SCOL$=CHR$(GETBVALUE(COL&))+CHR$(GETGVALUE(COL&))+CHR$(GETRVALUE(COL&))
WHILE 1
P&=INSTR(SCOL$,DATA$,C&)
IFNOT P&
BREAK
ENDIF
IFNOT (P&-1) MOD 4
RETURN P&*0.25
ENDIF
C&=P&+1
ENDWHILE
RETURN -1
endproc
The Difference lying therein the in the 1. example The Suchfunktion 2x called becomes CompileMarkSeparation and in the 2. example ditto, though by Whileloop CompileMarkSeparation in the 2. example I will hereon hingewiesen the Scol$ not declared be, though of understanding since the same occur ought to. naturally power the double appeal none sense. These mutants are solely to Fehlersuche emerged. |
| | | | |
| | | I have tested 2 time aufzurufen + works. On The speedy could I in Your example whom Error not discern. CompileMarkSeparation {$cleq}
{$runtime c:xprofan11}
randomize
const xx=1024
const yy=1024
cls
long hPic=create(hNewPic,xx,yy,0)
long x=rnd(xx),y=rnd(yy)
long col=$00FF00
startPaint hPic
setPixel x,y,col
endPaint
long somePos=hPic.PixelSearch(hPic,col,xx,yy)
print x,y
print hiWord(somePos),loWord(somePos)
x=rnd(xx)
y=rnd(yy)
startPaint hPic
cls
setPixel x,y,col
endPaint
somePos=hPic.PixelSearch(hPic,col,xx,yy)
locate 3,1
print x,y
print hiWord(somePos),loWord(somePos)
waitInput
end
string hPic.bgr2String(long h,_width,_height){
long sz=( (_width*328-1) | 3 +1) * abs(_height)
mem mem=bitmapInfoHeader
with mem
.biSize& = sizeof(mem)
.biWidth& = _width
.biHeight& = _height
.biPlanes% = 1
.biBitCount% = 32
.biCompression& = BI_RGB
.biSizeImage& = sz
endwith
mem data=sz
string ret=error
case ~getDIBits(hDC,h,,_height,data,mem,) : ret=char$(data,0,sz)
dispose data
dispose mem
return ret
}
long hPic.PixelSearch(long h,colorToFind,_width,_height){
string rawData=hPic.bgr2String(h,_width,_height)
long _fnd=hPic.findColorInRawData(colorToFind,rawData)
case _fnd==-1 : return _fnd
long x=_fnd mod _width,y
case _fnd > 0 : y=_fnd\_width
return x*65536+(_height-y-1)
}
long hPic.findColorInRawData(long col,string data){
long c=1,p
string sCol=chr$(getBValue(col))+chr$(getGValue(col))+chr$(getRValue(col))
do {
p=instr(sCol,data,c)
casenot p : break
casenot (p-1) mod 4 : return p*0.25
c=p+1
}
return span class=s2>- 1
}
If it then later ums find more Pixel goes would I hPic.bgr2String only einmalig Call. |
| | | | |
| | Jörg Sellmeyer | look time in the Help under Return to:
important: even if a procedure with Return leave becomes, must The Definition the procedure with ENDPROC completed go. the leave of/ one procedure must not within of/ one While-/Repeat-Loop erfolgen.
|
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 03/04/09 ▲ |
| |
| | Christian Schneider | thanks, the declared some. |
| | | | |
| | | | | | | |
| | | | - Page 4 - |
| | Christian Schneider | an Variante also several Vorkommen lists CompileMarkSeparation $H windows.ph
STRUCT BITMAPINFOHEADER=BISIZE&,BIWIDTH&,BIHEIGHT&,BIPLANES%,BIBITCOUNT%,BICOMPRESSION&,BISIZEIMAGE&,BIXPELSPERMETER&,BIYPELSPERMETER&,BICLRUSED&,BICLRIMPORTANT&
Declare SEARCHPOSITION&,SOMEPOS&[],Rawdata$
SEARCHPOSITION&=1
RANDOMIZE
CLS
var HPIC&=CREATE(hNewPic,1024,1024,0)
var X&=RND(1024)
var Y&=RND(1024)
var COL&=$00FF00
STARTPAINT HPIC&
SETPIXEL 1,999,COL&
SETPIXEL 100,230,COL&
SETPIXEL 100,220,COL&
SETPIXEL 100,231,COL&
ENDPAINT
suchfunktion(1024,1024,COL&)
Whileloop Sizeof(Somepos&[])
PRINT HIWORD(SOMEPOS&[&Loop-1]),LOWORD(SOMEPOS&[&loop-1])
Endwhile
WAITINPUT
END
proc suchfunktion
Clear Rawdata$
Clear Somepos&[]
Parameters searchx&,searchy&,color&
var durchlauf&=0
var arraysize&=2
Somepos&[0]=0
Whilenot SOMEPOS&[arraysize&-2]=-709309
SOMEPOS&[durchlauf&]=HPIC.PIXELSEARCH(HPIC&,color&,1024,1024)
SOMEPOS&[durchlauf&+1]=0
arraysize&=sizeof(somepos&[])
inc durchlauf&
Endwhile
SetSize Somepos&[], (Sizeof(Somepos&[])-2)
clear durchlauf&
endproc
proc HPIC.BGR2STRING
PARAMETERS H&,_WIDTH&,_HEIGHT&
var SZ&=( (_WIDTH&*328-1) | 3 +1) * ABS(_HEIGHT&)
DECLARE MEM#
DIM MEM#,BITMAPINFOHEADER
WITH MEM#
.BISIZE&=SIZEOF(MEM#)
.BIWIDTH&=_WIDTH&
.BIHEIGHT&=_HEIGHT&
.BIPLANES%=1
.BIBITCOUNT%=32
.BICOMPRESSION&=0
.BISIZEIMAGE&=SZ&
ENDWITH
DECLARE DATA#
DIM DATA#,SZ&
var RET$=
IF ~GetDIBits(%HDC,H&,0,_HEIGHT&,DATA#,MEM#,0)
RET$=CHAR$(DATA#,0,SZ&)
ENDIF
DISPOSE DATA#
DISPOSE MEM#
RETURN +RET$
endproc
proc HPIC.PIXELSEARCH
PARAMETERS H&,COLORTOFIND&,_WIDTH&,_HEIGHT&
if @len(rawdata$)<1
RAWDATA$=HPIC.BGR2STRING(H&,_WIDTH&,_HEIGHT&)
endif
var _FND&=HPIC.FINDCOLORINRAWDATA(COLORTOFIND&,RAWDATA$)
IF _FND&=-1
RETURN _FND&
ENDIF
var X&=_FND& MOD _WIDTH&
var Y&=0
IF _FND& > 0
Y&=_FND&\_WIDTH&
ENDIF
RETURN X&*65536+(_HEIGHT&-Y&-1)
endproc
proc HPIC.FINDCOLORINRAWDATA
PARAMETERS COL&,DATA$
var C&=SEARCHPOSITION&
var P&=0
var SCOL$=CHR$(GETBVALUE(COL&))+CHR$(GETGVALUE(COL&))+CHR$(GETRVALUE(COL&))
P&=INSTR(SCOL$,DATA$,C&)
SEARCHPOSITION&=P&+1
IFNOT P&
RETURN -1000000000000
ENDIF
IFNOT (P&-1) MOD 4
RETURN P&*0.25
EndIF
C&=P&+1
endproc
|
| | | | |
| | | the heard but sooner here [...] there (Please there complement) - here goes it Yes circa AutoItX3.dll - PixelSearch Funktionsaufruf. |
| | | | |
| | Christian Schneider | everything clear I packs moreover. thought me only the of Urthema here eh not any more so plenty spare is. |
| | | | |
|
AnswerTopic-Options | 23.017 Views |
Themeninformationenthis Topic has 5 subscriber: |