Habe eine einfacherere Möglichkeit gefunden
[autoit]WinWait("Download beendet")
WinActivate("Download beendet")
ControlClick("Download beendet", "","[CLASS:Button; INSTANCE:4]");
Damit wird auch das Fenster nach Download geschlossen.
Habe eine einfacherere Möglichkeit gefunden
[autoit]WinWait("Download beendet")
WinActivate("Download beendet")
ControlClick("Download beendet", "","[CLASS:Button; INSTANCE:4]");
Damit wird auch das Fenster nach Download geschlossen.
So soweit hab ich jetzt alles fertig, der Code ist mit Sicherheit verbesserungswürdig oder vereinfachungsfähig, aber fürs erste Mal bin ich ganz zufrieden Vielen Dank mal an alle für die Hilfe.
[autoit]#include <IE.au3>
#include <Inet.au3>
;Maus sund Tastatur blocken
BlockInput(1)
;Erstellt eine Instanz (neues Fenster) des InternetExplorers und gibt ein entsprechendes Objekt zurück.
$oIE = _IECreate ("URL1")
;Prüfen ob ein Objekt erzeugt wurde
If IsObj($oIE) Then
;Erzeugen eines HTML-Formular-Objekts mit Hilfe des Formularnamens
$oForm = _IEFormGetObjByName($oIE, "UserLogin")
;Erzeugen eines Formularfeld-Objekts mit Hilfe des Feldnames
$oUsername = _IEFormElementGetObjByName($oForm, "user")
;Setzen des Formularfeldinhalts
_IEFormElementSetValue($oUsername, "xyz")
;Erzeugen eines Formularfeld-Objekts mit Hilfe des Feldnames
$oPasswd = _IEFormElementGetObjByName($oForm, "password")
;Setzen des Formularfeldinhalts
_IEFormElementSetValue($oPasswd, "zyx")
;Absenden des Formulars
$oSubmit = _IEGetObjByName ($oIE, "submit")
_IEAction ($oSubmit, "click")
_IELoadWait($oIE)
;Website mit Downloadassistent aufrufen
_IENavigate($oIE,'URL2')
;Link für Download-Assistent suchen und in $downloadlink speichern
$links = _IELinkGetCollection( $oIE )
if @error then MsgBox(0,'',@error)
For $link in $links
If StringInStr( $link.href, 'pdfwizardservlet?release' ) Then
$downloadlink = $link.href
ExitLoop
EndIf
Next
;Downloadseite öffnen
_IENavigate($oIE,$downloadlink)
_IELoadWait($oIE)
;Alle Seiten markieren
$oSubmit = _IEGetObjByName ($oIE, "chkAllPages")
_IEAction ($oSubmit, "click")
;pdfservlet zum Download aufrufen
$oSubmit = _IEGetObjByName ($oIE, "go")
_IEAction ($oSubmit, "click")
;Warten auf Downloadfenster
WinWaitActive("Dateidownload","")
WinActivate("Dateidownload")
;Speichern unter aktuellem Datum
Send("{Altdown}{s}{altup}")
Send(@YEAR & "-" & @MON & "-" & @MDAY & ".pdf")
Send("{Altdown}{s}{altup}")
If WinActive("Speichern unter") then Send("{Altdown}{j}{altup}")
;Warten bis DownloadComplete
WinWait("Download beendet")
WinActivate("Download beendet")
ControlClick("Download beendet", "","[CLASS:Button; INSTANCE:4]");
$oIE.quit
WinClose("PDF-Seitenerstellung")
;Freigeben von Maus und Tastatur
BlockInput(0)
EndIf
Hab nur die URLs und das übliche rausgenommen.