Neue Funktionen und ToDo-List

  • Die Funktion _FFClickImageBySize habe ich mal versuchshalber neu geschrieben. Sieht schlimm aus und ist noch nicht besonders schnell, aber was haltet ihr vom Funktionsprinzip?
    (Sinn der Funktion ist es alle Bild-Links mit einer bestimmten Bild-Größe auf einer Seite anzuklicken)

    FF.au3 mit der neuen Version:
    http://thorsten-willert.de/Themen/AutoIt-…tversion/FF.au3

    Test Programm:

    Spoiler anzeigen
    [autoit]

    #region Includes
    #include <FF.au3>
    #endregion Includes

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

    $Socket = _FFStart("http://thorsten-willert.de/html/FF-test.html",default,2)

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

    msgbox(64,"","lt 20x20")
    _FFClickImageBySize($Socket,20,20,"lt")

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

    msgbox(64,"","eq 16x100")
    _FFClickImageBySize($Socket,16,100,"eq")

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

    msgbox(64,"","gt 16x100")
    _FFClickImageBySize($Socket,16,100,"gt")

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

    _FFAction($Socket,"Alert","Ende des Beispiels.")

    [/autoit]

    Grüße
    Stilgar

  • Als nächste und abschließend wohl wichtigste Funktion, alles andere wird nur noch "Spielerei", kommt:
    _FFFormOptionSelect
    zur Auswahl von Listenfeldern.

    Die Syntax wird so aussehen:

    ByRef $Socket, $vSelect, $sSMode, $vIndex, $sIMode, $vForm, $sFMode, $iTabIndex

    $vSelect = Liste
    $sSMode = Auswahlmodus der Liste: Name, Index, ID
    $vIndex = Auswahl
    $vIMode = Auwahl anhand von: Index, ID?, Text, Value
    $vForm = Formular
    $sFMode = Auswahlmodus des Formulars: Name, Index, ID
    $iTabIndex = Index des Tabs

    was haltet ihr davon?
    Wie könnte man eine Mehrfach-Auswahl lösen? Evtl. bei $vIndex ein Array übergeben?

    * Eine Frage zu den Tabs:
    Was haltet Ihr davon statt jedem Befehl den Tab-Index zu übergeben, das Ganze einfach wegzulassen?
    Wenn jemand den Tab wechseln möchte, kann er das ja ganz einfach selbst machen ...
    oder
    Einen Weg finden, daß der evtl. auf einem nicht aktiven Tab gearbeitet wird und eine ähnliche Lösung wie für die Frames einbauen.

    Viele Grüße
    Stilgar

  • Hey Stilgar,
    ob das was für uns ist?
    UbiquityCommanding Your Browser. habe ich gerade gefunden und kurz überflogen ... :)

    Command Tutorial

    Interacting with Other Extensions:
    Vielleicht kann man damit den MozRepl starten wenn dieser aus ist ...

    Grüße
    Frank

    2 Mal editiert, zuletzt von thunder-man (13. August 2008 um 00:14)

  • Hallo,

    das mit der _FFFormOptionSelect Funktion interessiert mich. Die Syntax schaut ganz passend aus - wann könnte man mit dieser Funktion rechnen? Der ff.au3 fehlt wirklich nur noch diese Funktion um rundum ausgewogen zu sein :) Solange muss ich noch mit simulierten Tastendrücken arbeiten..

    Gruß

  • Aus einem kleinen PM-Wechsel mit "Kairu" aus dem englischen Forum hat sich folgende Such- Funktion ergeben:

    Spoiler anzeigen
    [autoit]

    Func _FFFind(ByRef $Socket, $sSearchString, $bCaseSensitive = false, $bBackwards = false, $bWrapAround = true, $bWholeWord = false, $bSearchInFrames = true, $bShowDialog = false, $iDelay = 0)
    If Not __FFIsSocket($Socket) Then
    SetError(__FFError("_FFFind", $_FF_ERROR_SocketError))
    Return ""
    EndIf
    If $sSearchString = "" Then
    SetError(__FFError("_FFFind", $_FF_ERROR_InvalidValue, "$sSearchString: " & $sSearchString))
    Return ""
    EndIf

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

    If $bCaseSensitive = Default Then $bCaseSensitive = false
    If $bBackwards = Default Then $bBackwards = false
    If $bWrapAround = Default Then $bWrapAround = true
    If $bWholeWord = Default Then $bWholeWord = false
    If $bSearchInFrames = Default Then $bSearchInFrames = true
    If $bShowDialog = Default Then $bShowDialog = false

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

    Local $sCommand = 'content.find("' & $sSearchString & '", ' & _
    __FFB2S($bCaseSensitive) & ', ' & _
    __FFB2S($bBackwards) & ', ' & _
    __FFB2S($bWrapAround) & ', ' & _
    __FFB2S($bWholeWord) & ', ' & _
    __FFB2S($bSearchInFrames) & ', ' & _
    __FFB2S($bShowDialog) & ')'

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

    Return _FFSetGet($Socket, $sCommand, 30 + $_FF_CON_DELAY + $iDelay)

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

    EndFunc ;==>_FFFind

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

    Func __FFB2S($bBool)
    If IsBool($bBool) Then
    If $bBool Then
    Return "true"
    Else
    Return "false"
    EndIf
    Else
    SetError(__FFError("__FFB2S", $_FF_ERROR_InvalidDataType, "Boolean: " & $bBool))
    Return ""
    EndIf
    EndFunc ;==>__FFB2S

    [/autoit]

    die so oder so ähnlich in die nächste Version mit einfließt.
    Damit lassen sich alle Such-Parameter einstellen, die auch im Such-Dialog möglich sind.

    Grüße
    Stilgar

  • Eine neue Testversion:
    http://thorsten-willert.de/Themen/AutoIt-…tversion/FF.au3

    nur ein paar winzige Änderungen:
    - _FFClick kann nun Elemente mit ID und Name/Index direkt ansprechen z.B.

    [autoit]

    _FFClick($Socket,"test","id")

    [/autoit]


    _FFClick(ByRef $Socket, $sObject, $sMode, $iIndex = 0, $iTabIndex = -1)
    $sMode = name, id
    $iIndex = 0-n wenn $sMode = name
    - Neuer URL-Shortcut für den Download-Manager / Aufruf über:

    [autoit]

    _FFStart("chrome:downloads") ;oder
    _FFOpenURL($Socket,"chrome:downloads") ;oder
    _FFAction($Socket,"chrome","downloads")

    [/autoit]

    Viel Spaß damit

    3 Mal editiert, zuletzt von Stilgar (22. Januar 2009 um 22:49)

  • Neue Testversion V0.2.5.1:
    http://thorsten-willert.de/Themen/AutoIt-…tversion/FF.au3

    * NEW: now you can use with _FFClick tag-names, too:
    e.g.: _FFClick($Socket,"img","tag",7)
    * NEW: added "copy" to _FFAction: returns the current selected
    text
    * NEW: added a simple "reload" without options to _FFAction
    * REMOVED: search/find with options from _FFAction -
    use _FFSearch instead.
    * MISC: Renamed in _FFClick objects to elements (like in DOM)

    - Als nächstes werde ich alle Funktionen nochmals überarbeiten, vor allem dieses "Default" als Parameter erscheint mir manchmal eher zufällig zu klappen ?(
    - dann einige Routinen noch in den Browser auslagern, bei zu viel Kommunikation sinkt die Performance leider rapide
    - und dann kommt endlich noch die letzte _FFForm-Funktion für Listen (select) dazu.

    [EDIT]
    Test-Seite nach:
    ff-au3-example.thorsten-willert.de
    verlegt. (evtl zum Zeitpunkt der Drucklegung noch nicht aktiv.)

    Viel Spaß damit!
    Stilgar

    Einmal editiert, zuletzt von Stilgar (24. Januar 2009 um 17:41)

  • Wieder was zum Testen V0.2.5.2:
    * NEW: _FFGetLinks is much faster now, because all informations
    collected via JavaScript now.
    * NEW: A new JavaScript (internal) function: FF_GetLinks(sInfo,iFrame)
    * NEW: _FFAction / copy works now with frames, too.
    If there multiple selections in different frames, they are returned
    as one string with a delimiter (| by default or an other one as $sOption)
    Multiple selections in one page are not supported yet, they are returned
    as one string.
    * FIXED: Error message from FF if the profile "default" was as -P parameter in the FF commandline
    * FIXED: Added workaround in _FFStart() to start FF in hidden mode
    * MISC: Browser version is now only checked at the first connection

    Viel Spaß damit!

    Grüße
    Stilgar

  • Ein neuer Test V0.2.5.3:
    http://thorsten-willert.de/Themen/AutoIt-…rsion/index.php

    * NEW: Added a console-message to _FFQuit
    * NEW: Added: "default" keyword for a blank page in _FFTabAdd:
    _FFTabAdd($Socket, Default) and return-values
    * NEW: Added some parameter checks to _FFFrameEnter
    * NEW: Added history, applets, embeds and plugins to _FFGetLength
    * NEW: Added the keywords "all, selected, prev, next, first, last" to _FFTabClose
    * Optimized: _FFGetLength, _FFFrameEnter, _FFFrameSelected, _FFFormCheckBox,
    _FFTabAdd, _FFTabClose, _FFTabSelect

    Viel Spaß damit!
    Stilgar

  • Wieder was zum Testen:

    http://thorsten-willert.de/Themen/AutoIt-…rsion/index.php

    [autoit]

    ; Name ..........: _FFFormOptionSelect
    ; Description ...:
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: _FFFormOptionSelect(ByRef $Socket[, $vSelect = 0[, $sSMode = "index"[, $vIndex = 0[, $sIMode = "index"[, $vForm = 0[, $sFMode = "index"]]]]]])
    ; Parameter(s): .: $Socket - TCP socket to MozRepl
    ; $vSelect - Optional: (Default = 0) : Name or index of element
    ; $sSMode - Optional: (Default = "index") : index, name
    ; $vIndex - Optional: (Default = 0) : Index, text or value of option
    ; $sIMode - Optional: (Default = "index") : index, text, value
    ; $vForm - Optional: (Default = 0) : Name, index or id of form
    ; $sFMode - Optional: (Default = "index") : index, name, id
    ; Return Value ..: Success - Selected index (0-n)
    ; Failure - -1

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

    ;Aufruf z.B.
    $Socket = _FFStart("http://de.selfhtml.org/javascript/objekte/anzeige/option_value.htm")
    _FFFormOptionSelect($Socket, "Auswahl", "name", "Schlampe!", "value", "Testform", "name")

    [/autoit]


    Multiselect wird noch nicht unterstützt.

    Viel Spaß damit!
    Grüße
    Stilgar

    Einmal editiert, zuletzt von Stilgar (4. Februar 2009 um 14:38)

  • Nochmal eine neue Funktion und ein paar Änderungen V0.3.5.6:

    http://thorsten-willert.de/Themen/AutoIt-…rsion/index.php
    * NEW: _FFTabDuplicate(ByRef $Socket, $bToFront = false)
    * NEW: _FFLoadWait: Added Default keyword for $iDelay and $iTimeOut
    * CHANGED!!!: _FFAction: replaced all "true" and "false" strings with boolean true / false
    * CHANGED: _FFFormReset now returns 1 on success otherwise 0
    * CHANGED: _FFGetLinks, removed the parameter "length"
    if @error the return value is now -1
    Use instead: _FFGetLength()
    * OPTIMIZED: _FFClick

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ===================================================================
    ; Name ..........: _FFTabDuplicate
    ; Description ...: Duplicates the current tab
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: _FFTabDuplicate(ByRef $Socket[, $bToFront = false])
    ; Parameter(s): .: $Socket - TCP socket to FireFox
    ; $bToFront - Optional: (Default = false) :
    ; Return Value ..: Success - Length of tabs >= 1
    ; Failure - 0
    ; @ERROR -
    ; Author(s) .....: Thorsten Willert
    ; Modified ......: Sat Feb 07 21:18:05 CET 2009
    ; Related .......:
    ; Example .......: Yes
    ; ==============================================================================
    Func _FFTabDuplicate(ByRef $Socket, $bToFront = false)

    [/autoit]

    Reicht die so? Oder soll man noch angeben können welcher Tab dupliziert wird, also:
    _FFTabDuplicate(ByRef $Socket, $vTab = -1, $sMode = "index" , $bToFront = false)

    Was meint Ihr?

    Viele Grüße
    Stilgar

  • nicht zwingend, aber optional wäre das schon gut. vll einfach als default "current tab" lassen und falls man nen andern brauch halt zuweisen

  • Also in der aktuellen Version sieht das dann so aus:

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ===================================================================
    ; Name ..........: _FFTabDuplicate
    ; Description ...: Duplicates a tab
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: _FFTabDuplicate(ByRef $Socket[, $vTab = -1[, $sMode = "index"[, $bToFront = false]]])
    ; Parameter(s): .: $Socket - TCP socket to FireFox
    ; $vTab - Optional: (Default = -1) : Tab to duplicate
    ; $sMode - Optional: (Default = "index") : index, label
    ; $bToFront - Optional: (Default = false) : Bring duplicated tab to front
    ; Return Value ..: Success - Lenght of tabs >= 1
    ; Failure - 0
    ; @ERROR -
    ; Author(s) .....: Thorsten Willert
    ; Modified ......: Sun Feb 08 14:31:57 CET 2009
    ; Related .......: _FFTabAdd, _FFTabClose, _FFTabCloseAll, _FFTabExists, _FFTabLength, _FFTabSelect, _FFTabSelected
    ; Example .......: Yes
    ; ==============================================================================
    Func _FFTabDuplicate(ByRef $Socket, $vTab = -1, $sMode = "index", $bSelect = false)

    [/autoit]

    Download:
    http://thorsten-willert.de/Themen/AutoIt-FF.au3/FF.au3/FF.au3

    Grüße
    Stilgar

  • Mal wieder was zum Testen V0.3.5.9:

    http://www.thorsten-willert.de/Themen/AutoIt-…tversion/FF.au3

    Änderungen seit V0.3.5.6:
    V0.3.5.9:
    - Removed error message on the first connection
    - Removed FF-status messages form _FFLoadWait
    - browser version now only checked on the first connection
    - optimized communication speed
    - changed FF_AutoItScript.SimulateClick to click on X/Y coordinates
    - changed _FFFrameEnter now returns the name or index depending
    on the mode

    V0.3.5.8:
    RENAMED SOME FUNKTIONS! I have build in some wrappers, but I removed
    them in the future:
    - _FFGetLinks => _FFLinksGetAll
    - _FFTabSelect => _FFTabSetSelected
    - _FFTabSelected => _FFTabGetSelected
    - _FFTabLength => _FFTabGetLength

    V0.3.5.7:
    * NEW: _FFTabDuplicate(ByRef $Socket[, $vTab = -1[, $sMode = "index"[, $bToFront = false]]])
    * CHANGED: _FFTabClose, complete new, now returns 1 on success otherwise 0
    * UPDATED: _FFTabCloseAll

    Viel Spaß beim Ausprobieren!

  • Nächster Test V0.3.6.0:

    http://www.thorsten-willert.de/Themen/AutoIt-…tversion/FF.au3

    Hauptsächlich Optimierungen und einige Funktionen nun mit eindeutigen Return Values:

    - Added: _FFFormSubmit now with $bLoadWait parameter, default = true
    - Changed: _FFGetValueById now sets error $_FF_ERROR_NoMatch if "id" is not found
    - Changed: _FFGetValueByName now sets error $_FF_ERROR_NoMatch if "name" is not found
    - Changed: _FFSetValueById now returns now 1 by success, otherwise 0, added parameters checks
    - Changed: _FFSetValueByName now returns now 1 by success, otherwise 0, added parameters checks
    - Changed: _FFLinksGetAll now returns an array with infomations of all links
    - Changed: Now WinTitleMatchMode is only changed in the internal function __FFConnect
    - Removed some parameter checks in internal-functions
    - Optimized all JavaScripts

    Komplettumbau von _FFGetLinks: gibt nun Array mit (fast) allen Informationen über alle Links zurück und heist in Zukunft:
    _FFLinksGetAll:

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ===================================================================
    ; Name ..........: _FFLinksGetAll
    ; Description ...: Get informations of all links
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: _FFLinksGetAll(ByRef $Socket)
    ; Parameter(s): .: $Socket - TCP socket to FireFox
    ; Return Value ..: Success - 2 dim array with the link informations:
    ; - array[n][0] = href
    ; - array[n][1] = hash
    ; - array[n][2] = search
    ; - array[n][3] = name
    ; - array[n][4] = id
    ; - array[n][5] = text
    ; - array[n][6] = innerHTML
    ; - array[n][7] = target
    ; - array[n][8] = protocol
    ; - array[n][9] = port
    ; Failure - Array[0][0] = -1
    ; @ERROR -
    ; Author(s) .....: Thorsten Willert
    ; Modified ......: Sat Jan 24 21:35:27 CET 2009
    ; Example .......: Yes
    ; ==============================================================================

    [/autoit]

    Grüße Stilgar