Script für IE.au3 umschreiben nach FF.au3

  • Hey Leute also mein Script läuft prima nur mit dem IE gibts immerwieder probleme auf
    verschidenen systemen und so... deswegen wollt ich jetz alles nach FF umschreiben brauche
    dabei aber hilfe kriegs nicht so ganz hin, hier mein IE script:

    [autoit][/autoit][autoit][/autoit][autoit]

    $oIE = _FFStart ("http://www.homepage.info/board/index.php", 1, 0, 1)
    _FFLoadWait ($oIE)
    _FFOpenURL ($oIE, "http://www.homepage.info/board/newthread.php?boardid=" & $boardid )
    _FFLoadWait ($oIE)
    $oForm = _IEFormGetObjByName ($oIE, "bbform")
    _IEFormElementRadioSelect ($oForm, $iconid, "iconid", 1, "byValue")

    [/autoit][autoit][/autoit][autoit]

    $oQuery = _IEFormElementGetObjByName ($oForm, "topic")
    _IEFormElementSetValue ($oQuery, $topic )

    [/autoit][autoit][/autoit][autoit]

    $oQuery = _IEFormElementGetObjByName ($oForm, "prefix")
    _IEFormElementSetValue ($oQuery, $prefix )

    [/autoit][autoit][/autoit][autoit]

    Sleep ( 2000 )

    [/autoit][autoit][/autoit][autoit]

    $oQuery = _IEFormElementGetObjByName ($oForm, "attachmentbutton")
    _IEAction ($oQuery, "click")

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    ;; ATTACHMENT POPUP
    WinWaitActive("USENET-SPACE-COWBOYS | Da")
    $oIEpop = _IEAttach ("USENET-SPACE-COWBOYS | Da")
    _IEAction ($oIEpop, "invisible") ;;; VERSTECKE POPUP
    $oForm = _IEFormGetObjByName ($oIEpop, "attachmentupload")
    $oQuery = _IEFormElementGetObjByName ($oForm, "attachment_file")
    WinActivate("USENET-SPACE-COWBOYS | Da")
    _IEAction($oQuery, "focus")
    Send($attachfile1)
    $oQuery = _IEFormElementGetObjByName ($oForm, "submit")
    _IEAction ($oQuery, "click")
    _IELoadWait ($oIEpop)
    Sleep( 2000 )
    $sHTML = _IEDocReadHTML ($oIEpop)
    $result = StringInStr($sHTML, "[attach]" )
    $resutt2 = StringTrimLeft($sHTML, $result -1 )
    $result3 = StringInStr($resutt2, "[/attach]" )
    $result4 = StringLeft($resutt2, $result3 + 8)
    $attach1 = $result4

    [/autoit]


    lese jetz sein über 2 stunden die doku zur ff.au3 und diese vergleistabelle,
    aber bekomms einfach nicht hin wäre super wenn jemand helfen könnte

    vielen dank

    euer nova

  • Grob übersetzt so:

    Spoiler anzeigen
    [autoit]

    _FFStart ("http://www.homepage.info/board/index.php", 1, 0, 1) ; gibt Erfolg zurück 1 /0
    ; _FFLoadWait ($oIE) macht _FFStart schon
    _FFOpenURL ("http://www.homepage.info/board/newthread.php?boardid=" & $boardid )
    ; _FFLoadWait ($oIE) macht _FFOpenURL
    ; $oForm = _IEFormGetObjByName ($oIE, "bbform")
    ;_IEFormElementRadioSelect ($oForm, $iconid, "iconid", 1, "byValue")
    _FFFormRadioButton($iconid,0,"value","bbform","name")

    [/autoit] [autoit][/autoit] [autoit]

    ; $oQuery = _IEFormElementGetObjByName ($oForm, "topic")
    ;_IEFormElementSetValue ($oQuery, $topic )
    _FFSetValueByName("topic", $topic)

    [/autoit] [autoit][/autoit] [autoit]

    ;$oQuery = _IEFormElementGetObjByName ($oForm, "prefix")
    ;_IEFormElementSetValue ($oQuery, $prefix )
    _FFSetValueByName("prefix" $prefix)

    [/autoit] [autoit][/autoit] [autoit]

    ; Sleep ( 2000 ) warum?

    [/autoit] [autoit][/autoit] [autoit]

    ;$oQuery = _IEFormElementGetObjByName ($oForm, "attachmentbutton")
    ;_IEAction ($oQuery, "click")
    _FFClick("attachmentbutton","name"

    [/autoit] [autoit][/autoit] [autoit]

    ; Hier kommt es darauf an was in FF eingestellt ist.
    ; Das Popup könnte auch in einem neuen Tab aufgehen ...
    ;; ATTACHMENT POPUP
    WinWaitActive("USENET-SPACE-COWBOYS | Da")
    WinSetState("USENET-SPACE-COWBOYS | Da","",@SW_HIDE )
    ;$oIEpop = _IEAttach ("USENET-SPACE-COWBOYS | Da")
    _FFWindowSelect("USENET-SPACE-COWBOYS | Da","title")
    ;_IEAction ($oIEpop, "invisible") ;;; VERSTECKE POPUP
    ;$oForm = _IEFormGetObjByName ($oIEpop, "attachmentupload")
    ;$oQuery = _IEFormElementGetObjByName ($oForm, "attachment_file")
    WinActivate("USENET-SPACE-COWBOYS | Da")
    ;_IEAction($oQuery, "focus")
    _FFCmd(".getElementsByName('attachment_file')[0].focus()")
    Send($attachfile1)
    ;$oQuery = _IEFormElementGetObjByName ($oForm, "submit")
    _FFClick("submit","name")
    ;_IEAction ($oQuery, "click")
    ;_IELoadWait ($oIEpop)

    [/autoit] [autoit][/autoit] [autoit]

    #cs
    Was genau ließt du hier aus?

    [/autoit] [autoit][/autoit] [autoit]

    Sleep( 2000 )
    $sHTML = _IEDocReadHTML ($oIEpop)
    $result = StringInStr($sHTML, "[attach]" )
    $resutt2 = StringTrimLeft($sHTML, $result -1 )
    $result3 = StringInStr($resutt2, "[/attach]" )
    $result4 = StringLeft($resutt2, $result3 + 8)
    $attach1 = $result4
    #ce

    [/autoit]


    ohne den alten Befehlen:

    Spoiler anzeigen
    [autoit]

    If _FFStart("http://www.homepage.info/board/index.php", Default, 0, True) Then

    [/autoit] [autoit][/autoit] [autoit]

    _FFOpenURL ("http://www.homepage.info/board/newthread.php?boardid=" & $boardid )

    _FFFormRadioButton($iconid,0,"value","bbform","name")
    _FFSetValueByName("topic", $topic)
    _FFSetValueByName("prefix" $prefix)
    _FFClick("attachmentbutton","name")
    _FFLoadWait()

    WinWaitActive("USENET-SPACE-COWBOYS | Da")
    WinSetState("USENET-SPACE-COWBOYS | Da","",@SW_HIDE )
    _FFWindowSelect("USENET-SPACE-COWBOYS | Da","title")
    WinActivate("USENET-SPACE-COWBOYS | Da")
    _FFCmd(".getElementsByName('attachment_file')[0].focus()")
    Send($attachfile1)
    _FFClick("submit","name")
    _FFLoadWait()

    #cs
    Was genau ließt du hier aus?
    #ce
    EndIf

    [/autoit]

    ungetestet, da fehlendem Board ...

    Grüße
    Stilgar

  • Hey Stilgar erstmal danke für die schnelle reaktion,

    folgendes problem, also dein code funktioniert schonmal soweit super,
    jedoch öffnet sich das popup nicht, der zu klickende button dafür wird
    im php code generiert und sieht dann hinterher so aus:

    PHP
    <script type="text/javascript">
    document.write('<input type="button" value="Dateianh&auml;nge" name="attachmentbutton" onclick="window.open(\'attachmentedit.php?boardid=18&idhash=3ce9404700c85a14ce9ef0af9b7e1e0f&attachmentids=\'+document.bbform.attachmentids.value+\'\', \'moo\', \'toolbar=no,scrollbars=yes,resizable=yes,width=450,height=400\')" class="input"  />');
    </script>
    <noscript>
    <span class="normalfont"><a href="attachmentedit.php?boardid=18&amp;idhash=3ce9404700c85a14ce9ef0af9b7e1e0f" target="_blank">Dateianh&auml;nge</a></span>

    zu deiner frage was dort ausgelesen wird, mittels

    [autoit]


    Send($attachfile1)
    ;$oQuery = _IEFormElementGetObjByName ($oForm, "submit")
    _FFClick("submit","name")

    [/autoit]

    wird eine datei ins das "Durchsuchen" input dateifeld geschickt und
    abgesendet, nachdem hochladen wird der fürs forum bestimmte "[attach]fileid[/attach]"
    code angezeigt und genau diesen lese ich dort aus :)

    gruß

    nova

  • Hallo,

    zum ersteren Problem:
    Daß der Button mit JavaScript geschrieben hat auf die Funktionsweise von _FFClick keinen Einfluß (gerade nochmal getestet). Was zeigt denn die Ausgabe in der Console/Output des Editors an?
    Wäre es evtl. nicht einfacher das Popup in einem andren Tab zu öffnen, dann kann man sich die Anweisungen mit den Fenstern ganz sparen.

    Zum zweiteren, die fileid läßt sich einfacher so auslesen:

    Spoiler anzeigen
    [autoit]

    ;Global $sHTML = _FFReadHTML()
    Global $sHTML = "[attach]fileid bla laber[/attach]"

    [/autoit] [autoit][/autoit] [autoit]

    Global $aArray = StringRegExp($sHTML,"\[attach\](.*?)\[/attach\]",1)
    If Not @error Then MsgBox(64,"",$aArray[0])

    [/autoit]

    oder du hast mir Quellcode der um dieses "[attach]...[/attach]" herum ist, dann gehts ein bisschen schneller als mit _FFReadHTML (ist leider recht langsam).

    Grüße
    Stilgar

  • also hier mal die ausgabe der console:

    Spoiler anzeigen
    [autoit]


    _FFConnect: OS:WIN_XP WIN32_NT 2600 Service Pack 3
    _FFConnect: AutoIt:3.2.10.0
    _FFConnect: FF.au3:0.5.1.0b-0
    _FFConnect: IP:127.0.0.1
    _FFConnect: Port:4242
    _FFConnect: Delay: 2ms
    _FFConnect: Socket: 1688
    _FFConnect: Browser:Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8
    _FFOpenURL: http://www.homepage.info/board/index.php
    __FFSend: try{window.content.frames["top"].document.location.href="http://www.homepage.info/board/index.php";}catch(e){"_FFOpenURL_Error"};
    __FFRecv: http://www.homepage.info/board/index.php
    _FFLoadWait: ... loaded in 1653ms
    _FFOpenURL: http://www.homepage.info/board/newthread.php?boardid=18
    __FFSend: try{window.content.frames["top"].document.location.href="http://www.homepage.info/board/newthread.php?boardid=18";}catch(e){"_FFOpenURL_Error"};
    __FFRecv: http://www.homepage.info/board/newthread.php?boardid=18
    _FFLoadWait: .. loaded in 775ms
    __FFSend: try{window.content.frames["top"].document.evaluate("//form[@name='bbform']//input[@type='radio' and @value='50']",content.document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.checked=true;}catch(e){'_FFXPath_Error: '+e;};
    __FFRecv: 1
    __FFSend: (content.document.getElementsByName('topic')[0] != null ? content.document.getElementsByName('topic')[0].value='test' : '_FFSetValueByName_Err:');
    __FFRecv: test
    __FFSend: (content.document.getElementsByName('prefix')[0] != null ? content.document.getElementsByName('prefix')[0].value='divX' : '_FFSetValueByName_Err:');
    __FFRecv: divX
    __FFSend: FFau3.SimulateClick(content.frames["top"].document.getElementsByName('attachmentbutton')[0],0,0)
    __FFRecv: 1
    _FFLoadWait: . loaded in 22ms

    [/autoit]

    und der aktuelle code abschnitt:

    Spoiler anzeigen
    [autoit]


    #include <FF.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $boardid = "18"
    $topic = "test"
    $prefix = "divX"
    $iconid = "50"

    [/autoit] [autoit][/autoit] [autoit]

    If _FFStart("http://www.homepage.info/board/index.php", Default, 0, True) Then

    [/autoit] [autoit][/autoit] [autoit]

    _FFOpenURL ("http://www.homepage.info/board/newthread.php?boardid=" & $boardid )

    [/autoit] [autoit][/autoit] [autoit]

    _FFFormRadioButton($iconid,0,"value","bbform","name")
    _FFSetValueByName("topic", $topic)
    _FFSetValueByName("prefix", $prefix)
    _FFClick("attachmentbutton","name")
    _FFLoadWait()

    [/autoit] [autoit][/autoit] [autoit]

    WinWaitActive("USENET-SPACE-COWBOYS | Da")
    WinSetState("USENET-SPACE-COWBOYS | Da","",@SW_SHOW )
    _FFWindowSelect("USENET-SPACE-COWBOYS | Da","title")
    WinActivate("USENET-SPACE-COWBOYS | Da")
    _FFCmd(".getElementsByName('attachment_file')[0].focus()")
    Send("C:/CD4.33.4.jpg")
    _FFClick("submit","name")
    _FFLoadWait()

    [/autoit] [autoit][/autoit] [autoit]

    #cs
    Was genau ließt du hier aus?
    #ce
    EndIf

    [/autoit]

    also bis zum popup geht alles super, und thx für den attach code den werd ich auf jeden fall einbauen ;)

    so aber zurück zum problem, ob das attachment popup nu in nem neuen tab auf geht oder nicht, ist mir im
    prinzip egal, da das ganze später sowieso unsichtbar ablaufen soll, solange die weiteren eingaben an das
    popup gehen ist das vollkommen egal ob neues fenter tab oder sonst was :)

    gruß

    nova