#include <firefox.au3>
#include <string.au3>
#Include <Array.au3>
Opt("WinTitleMatchMode", 2)
HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc


DIM $daten
DIM $html


; Verbinden und alle Links der Seite in Variable (Array) speichern

_ffstart()
Send("[ALT]{TAB]")
_ffquit()
send("^w")
_ffconnect()




For $seite = 1 to 100 Step +1 

DIM $exposes[1]
WinActivate("Mozilla Firefox")

If _FFIsConnected() Then
	$aLinks = _FFLinksGetAll()
EndIf




send("^l")
send("^c")
sleep(500)
$ergebnisseite = clipget()
send("{TAB}{TAB}")





;~ ; alle Links nach "Exposes" durchsuchen und in Variable $aLinks speichern
For $p = 1 to 200 Step +1 
	if StringLeft ($aLinks[$p][0], 38 ) ="http://www.immobilienscout24.de/expose" then
	_ArrayAdd($exposes, $aLinks[$p][0])
	$p=$p+1
	endif
Next

WinActivate("Mozilla Firefox")

;~ ; Durchlauf mit allen 20 Links (Angeboten)
For $link = 1 to 20 Step +1 
_FFopenurl($exposes[$link])
_FFLoadWait()

send("^a")
send("^c")	
WinActivate("Microsoft Excel")
mouseclick("left",126,10,1,5)
sleep(500)
Send("{ALTDOWN}{TAB}{ALTUP}")
next

_FFopenurl($ergebnisseite)
_FFLoadWait()
_FFlinkclick("chste Seite","Text")


next
