Hallo Leute,
ich möchte mit einem AutoIT Skript herausfinden, ob mein Passwort Feld Leer oder gefüllt ist.
Leider kann man mit ControlGetText("TeamViewer", "", "Edit1") das Passwort nicht auslesen (logischerweise).
Ich habe versucht mit Pixelsearch das Passwort Feld nach einem nicht Weißen Pixel abzusuchen. Dies war jedoch Erfolglos.
Das Gleiche habe ich auch schon mit Pixelgetcolor versucht (ohne Erfolg).
Hat jemand eine Idee wie ich herausfinden könnte, ob das Passwortfeld gefüllt ist oder nicht?
Spoiler anzeigen
C
#include <Process.au3>
#include <String.au3>
#include <WinAPI.au3>
;Metrics
local $SM_CXCAPTION = _WinAPI_GetSystemMetrics(3)
local $SM_CYCAPTION = _WinAPI_GetSystemMetrics(4)
local $SM_CXBORDER = _WinAPI_GetSystemMetrics(5)
local $SM_CYBORDER = _WinAPI_GetSystemMetrics(6)
local $SM_CXFIXEDFRAME = _WinAPI_GetSystemMetrics(7)
local $SM_CYFIXEDFRAME = _WinAPI_GetSystemMetrics(8)
local $SM_CXEDGE = _WinAPI_GetSystemMetrics(45)
local $SM_CYEDGE = _WinAPI_GetSystemMetrics(46)
local $title = "TeamViewer"
;0=relative with borders, 1=absolute, 2=relative without window borders
local $coordMode = 1
AutoItSetOption("PixelCoordMode",$coordMode)
while true
local $window = WinWaitActive($title)
local $whnd = WinGetHandle($window)
MsgBox(1024,"handle",$whnd,1.5)
local $winPos = WinGetPos($whnd)
local $xy = ControlGetPos($whnd, "", "Edit1")
local $offsetx = 0
if $coordMode <> 2 then $offsetx = $SM_CXBORDER + $SM_CXFIXEDFRAME + $SM_CXEDGE; + $SM_CXCAPTION
if $coordMode == 1 then $offsetx = $offsetx + $winPos[0]
local $x = $xy[0] + $offsetx
local $offsety = 0
if $coordMode <> 2 then $offsety = $SM_CYCAPTION + $SM_CYBORDER + $SM_CYFIXEDFRAME + $SM_CYEDGE
if $coordMode == 1 then $offsety = $offsety + $winPos[1]
local $y = $xy[1] + $offsety
local $empty = true
local $colors = ""
for $j = 6 to 12 step 1
For $i = 2 to 20 step 1
$colors = $colors & "," & PixelGetColor($x + $i, $y + $j,$whnd)
;mousemove($x + $i, $y + $j,1)
;msgbox(1234,"test",pixelgetcolor($x + $i, $y + 9),0.5)
if PixelGetColor($x + $i, $y + $j,$whnd) > 10000000 then
$empty = false
;Break
endif
next
next
msgbox(4096,"test",$colors)
;TODO fix this
local $px = PixelSearch($x + $searchOffset,$y + $searchOffset,$x + $xy[2] - $searchOffset,$y + $xy[3] - $searchOffset,0x000000,20,1,$whnd)
if not @error then
$empty = true
MsgBox(4096,$px[0],$px[1],1)
MouseMove($px[0] + $winpos[0]+$SM_CXBORDER + $SM_CXFIXEDFRAME + $SM_CXEDGE,$px[1] + $winpos[1]+$SM_CYCAPTION + $SM_CYBORDER + $SM_CYFIXEDFRAME + $SM_CYEDGE)
EndIf
;TODO remove this
ContinueLoop
if $empty Then
ControlSetText($whnd, "", "Edit1", "1234")
EndIf
WinWaitClose($whnd ,"")
WEnd
Alles anzeigen