Wie kann ich im Firefox-Fenster die y-Pixelposition des mit dem Mauszeiger angezeigten Punktes ermitteln?
Vielen Dank schon einmal für eine Antwort!
Wie kann ich im Firefox-Fenster die y-Pixelposition des mit dem Mauszeiger angezeigten Punktes ermitteln?
Vielen Dank schon einmal für eine Antwort!
Effektiv weiß niemand einen Rat.
Beim Internet Explorer war das einfach mit ControlGetPos.
Ich habe es nun für Firefox so gemacht. Nicht elegant aber es funktioniert
Überarbeitet:
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
Global $browserExe="C:\Program Files\Mozilla Firefox\firefox.exe"
Global $browsertitel="Mozilla Firefox"
Opt("WinTitleMatchMode", 2) ; 1=vom Anfang, 2=enthält, 3=genau, 4=fortgeschritten, -1 bis -4=Groß-/Klein ignorieren
$exist=WinExists($browsertitel)
If $exist=0 Then
Run($browserExe)
WinWait($browsertitel, "", 10)
EndIf
$hWnd=WinActivate($browsertitel)
WinWaitActive($hWnd,"",10)
$y=yFirefox($hWnd)
MsgBox(0x40000,"Firefox-y-Pixelposition",$y)
If $exist=0 Then WinClose($hWnd)
;======================================================================
#cs ----------------------------------------------------------------------------
$hWnd Handle des Firefox-Fensters
Hinterlässt die y-Pixelposition unterhalb der Menüleisten
#ce ----------------------------------------------------------------------------
Func yFirefox($hWnd)
Local $yDatei="yFirefox.txt"
$vermutet = 0
$hdl=FileOpen($yDatei,0)
If $hdl<>-1 Then
$vermutet=FileRead($hdl)+0
FileClose($hdl)
EndIf
Do
$ppp=WinGetPos($hWnd)
$err=@error
Sleep (50)
Until $err<>1
If $vermutet<>0 AND PixelGetColor($ppp[0]+30,$vermutet-1)=0xCCCCCC Then Return $vermutet
;---- >
$gui=GUICreate("Progress", 220, 100, 400, 800 )
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
GUISetState(@SW_SHOW)
WinSetOnTop("Progress","",1 )
;---- <
$fehler=0
$vorher=0
For $i=$ppp[1] To $ppp[1]+$ppp[3]
$iColor=PixelGetColor($ppp[0]+30,$i)
If $iColor=0xCCCCCC Then
If $vorher=0xF5F6F7 Then ExitLoop
$fehler=1
ExitLoop
EndIf
$vorher=$iColor
If $i=$ppp[1]+$ppp[3] Then
$fehler=2
ExitLoop
EndIf
;---- >
If Mod($i,10)=0 Then GUICtrlSetData($progressbar1, ($i-$ppp[1])/2)
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
;---- <
Next
;---- >
GUIDelete($gui)
;---- <
$y=$i-$ppp[1]-7
If $fehler<>0 Then MsgBox(0x40000,"","Firefox-Fenster hat geänderten Aufbau"&@CRLF&@CRLF&" Abbruch!")
$hdl=FileOpen($yDatei,2)
FileWrite($hdl,$y)
FileClose($hdl)
;#cs
FileDelete($yDatei)
;#ce
Return $y
EndFunc
Alles anzeigen
Vielleicht möchtest du uns erstmal erzählen was dein Skript am Ende des Tages bewerkstelligen soll.
Manchmal sieht man den Wald vor lauter Bäumen nicht, und grundlos wild in einem Browser rumklicken kann ich auch nicht nachvollziehen.
Mein Programm für IE lief im Hintergrund, wenn ich Online-Banking mache.Hat alles beobachtet und mir Hilfestellungen gegeben.
Jetzt muss ich es auf Firefox umstellen.
Noch einen Fehler beseitigt:
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
Global $browserExe="C:\Program Files\Mozilla Firefox\firefox.exe"
Global $browsertitel="Mozilla Firefox"
Opt("WinTitleMatchMode", 2) ; 1=vom Anfang, 2=enthält, 3=genau, 4=fortgeschritten, -1 bis -4=Groß-/Klein ignorieren
$exist=WinExists($browsertitel)
If $exist=0 Then
Run($browserExe)
WinWait($browsertitel, "", 10)
EndIf
$hWnd=WinActivate($browsertitel)
WinWaitActive($hWnd,"",10)
$y=yFirefox($hWnd)
MsgBox(0x40000,"Firefox-y-Pixelposition",$y)
If $exist=0 Then WinClose($hWnd)
;======================================================================
#cs ----------------------------------------------------------------------------
$hWnd Handle des Firefox-Fensters
Hinterlässt die y-Pixelposition unterhalb der Menüleisten
#ce ----------------------------------------------------------------------------
Func yFirefox($hWnd)
Local $yDatei="yFirefox.txt"
$vermutet = 0
$hdl=FileOpen($yDatei,0)
If $hdl<>-1 Then
$vermutet=FileRead($hdl)+0
FileClose($hdl)
EndIf
Do
$ppp=WinGetPos($hWnd)
$err=@error
Sleep (50)
Until $err<>1
If $vermutet<>0 AND PixelGetColor($ppp[0]+30,$vermutet+$ppp[1]+7)=0xCCCCCC Then Return $vermutet
;---- >
$gui=GUICreate("Progress", 220, 100, 400, 800 )
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
GUISetState(@SW_SHOW)
WinSetOnTop("Progress","",1 )
;---- <
$fehler=0
$vorher=0
For $i=$ppp[1] To $ppp[1]+$ppp[3]
$iColor=PixelGetColor($ppp[0]+30,$i)
If $iColor=0xCCCCCC Then
If $vorher=0xF5F6F7 Then ExitLoop
$fehler=1
ExitLoop
EndIf
$vorher=$iColor
If $i=$ppp[1]+$ppp[3] Then
$fehler=2
ExitLoop
EndIf
;---- >
If Mod($i,10)=0 Then GUICtrlSetData($progressbar1, ($i-$ppp[1])/2)
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
;---- <
Next
;---- >
GUIDelete($gui)
;---- <
$y=$i-$ppp[1]-7
If $fehler<>0 Then MsgBox(0x40000,"","Firefox-Fenster hat geänderten Aufbau"&@CRLF&@CRLF&" Abbruch!")
$hdl=FileOpen($yDatei,2)
FileWrite($hdl,$y)
FileClose($hdl)
;#cs
;FileDelete($yDatei)
;#ce
Return $y
EndFunc
Alles anzeigen