; :wrap=none:collapseFolds=1:maxLineLen=80:mode=autoitscript:tabSize=8:folding=indent:
; created with jEdit4AutoIt
#include-once
#Region Copyright
#cs
* FF.au3
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ce
#EndRegion Copyright
#Region Many thanks to:
#cs
- Jonathan Bennett and the AutoIt Team for AutoIt v3 the freeware
BASIC-like scripting language
(and thanks John George Kemeny and Thomas Eugene Kurtz for BASIC)
- Dale Hohm, for his great IE.au3, which I've used as base for the
functions-names and the error handling.
- Johannes Schirmer, for some functions and suggestions for the FF.au3
- all others for their suggestions, bug reports ...
- the FireFox-Team for his fantastic browser
- and Massimiliano Mirra, without his work would this UDF impossible,
for MozLab / MozRepl
#ce
#EndRegion Many thanks to:
#Region #CURRENT# ==============================================================
;_FFAction
;_FFClick
;_FFCmd
;_FFConnect
;_FFDialogWait
;_FFDisConnect
;_FFDispatchEvent
;_FFDisPatchKeyEvent
;_FFFormCheckBox
;_FFFormGetElementsLength
;_FFFormGetLength
;_FFFormOptionSelect
;_FFFormRadioButton
;_FFFormReset
;_FFFormSubmit
;_FFFrameEnter
;_FFFrameGetSelected
;_FFFrameLeave
;_FFGetLength
;_FFGetObjectInfo
;_FFGetValueById
;_FFGetValueByName
;_FFImageClick
;_FFImageGetBySize
;_FFIsConnected
;_FFLinkClick
;_FFLinksGetAll
;_FFLoadWait
;_FFObj
;_FFObjDelete
;_FFObjGet
;_FFObjNew
;_FFOpenURL
;_FFPrefGet
;_FFPrefReset
;_FFPrefSet
;_FFQuit
;_FFReadHTML
;_FFReadText
;_FFSearch
;_FFSetValueById
;_FFSetValueByName
;_FFStart
;_FFTabAdd
;_FFTabClose
;_FFTabCloseAll
;_FFTabDuplicate
;_FFTabExists
;_FFTabGetLength
;_FFTabGetSelected
;_FFTabSetSelected
;_FFTableGetCell
;_FFTableWriteToArray
;_FFWindowClose
;_FFWindowGetHandle
;_FFWindowOpen
;_FFWindowSelect
;_FFWriteHTML
;_FFXPath
#EndRegion #CURRENT# ==============================================================
#Region Description
; ==============================================================================
; UDF ...........: FF.au3
Global Const $_FF_AU3VERSION = "0.5.3.8b"
; Description ...: An UDF for FireFox automation.
; Requirement ...: MozRepl AddOn:
; http://hyperstruct.net/projects/mozlab
; http://wiki.github.com/bard/mozrepl/home
; Author(s) .....: Thorsten Willert, Johannes Schirmer
; Date ..........: Fri Sep 04 11:50:31 CEST 2009 @451 /Internet Time/
; FireFox Version: Firefox/3.5.2 (required 3.x.x)
; AutoIt Version : v3.3.0.0
; ==============================================================================
#cs
V0.5.3.8b
- Added: _FFDispatchEvent($sElement, $sEventType = "change")
$sElement = Element or Object from _FFXpath and _FFObj*
$sEventType = change|select|focus|blur|resize
- Added: _FFDispatchKeyEvent: Now you can use as $sElement objects from _FFXpath and _FFObj*, too
- Added: Opt("TCPTimeOut", $_FF_CON_DELAY) to _FFConnect() / for connections over networks
- Added: JavaScript: FFau3.fireEvent(oObj,sEventType)
- Added: _FFTableWriteToArray: $iFilter-parameter
- Changed: _FFObj: Now creates an attribute instead of throwing a message that it doesn't exists
- Changed: _FFDispatchKeyEvent: Changed default event-type from keydown to keypress
- Changed: _FFTableWriteToArray: Complete new, much faster then the old version
- Changed: _FFFrameEnter now returns 1/0 and @extended = index of the entered frame
- Fixed: Error in _FFWindowGetHandle (=> _FFWindowSelect, _FFStart ...) with non ASCII-titles
- Fixed: Error in _FFFormSubmit
- Fixed: Error by sending ' as value
- Fixed: Error in _FFFrameEnter when selecting frame by id
V0.5.3.7b
- Added: __FFError: OutputDebugString in compiled scripts
- Changed: _FFTabExists: Returns now only 1 / 0, @EXTENDED is set to tab-index
- Removed: _FFClickXY
- Removed: Wrappers for:
_FFClickImage (_FFImageClick)
_FFClickLink (_FFLinkClick)
ToDo:
Textsuche (name, id, text ...) per Substring, String, RegEx
Events fuer die _FFForm* Funktionen
Update der Frame Funktionen
#ce
#EndRegion Description
#Region Global Constants
Global Const $_FF_PROC_NAME = "firefox.exe" ; Firefox process name
Global Const $_FF_COM_DELAY_MAX = 300 ; alternative connection delay in ms
Global Enum $_FF_ERROR_Success = 0, _ ; No error
$_FF_ERROR_GeneralError, _ ; General error
$_FF_ERROR_SocketError, _ ; No socket
$_FF_ERROR_InvalidDataType, _ ; Invalid data type (IP, URL, Port ...)
$_FF_ERROR_InvalidValue, _ ; Invalid value in function-call
$_FF_ERROR_SendRecv, _ ; Send / Recv Error
$_FF_ERROR_Timeout, _ ; Connection / Send / Recv timeout
$_FF_ERROR___UNUSED, _ ;
$_FF_ERROR_NoMatch, _ ; No match for _FFAction-find/search _FFGetElement...
$_FF_ERROR_RetValue, _ ; Error echo from Repl e.g. _FFAction("fullscreen","true") <> "true"
$_FF_ERROR_ReplException, _ ; Exception from MozRepl / FireFox
$_FF_ERROR_InvalidExpression ; Invalid expression in XPath query or RegEx
#EndRegion Global Constants
#Region Global Variables
Global $_FF_GLOBAL_SOCKET = -1 ; Socket
Global $_FF_CON_DELAY ; Connection Delay
Global $_aFF_STATUS[2][3] ; Status-Array
Global $_FF_COM_TRACE = True ; Trace communication to console (debugging)
Global $_FF_ERROR_MSGBOX = True ; Shows in compiled scripts error messages in msgboxes
Global $_aFF_ERRORS[1][5] ; Array with information about the last error
#EndRegion Global Variables
; #FUNCTION# ===================================================================
; Name ..........: _FFAction
; Description ...: Some standard actions to work with FireFox
; Beschreibung ..: Standardaktionen in FireFox
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFAction($sAction[, $vOption = ""[, $vOption2 = ""[, $bLoadWait = true]]])
; Parameter(s): .: $sAction - one of the following actions:
; | about
; | alert
; | back
; | blank
; | copy
; | fullscreen / fs
; | hideall
; | home
; | maximize / max
; | minimize / min
; | presentationmode / pm
; | print
; | reload
; | resetconsole
; | restore
; | search / find
; | scrollXY
; | stop
; | zoom
; $vOption - Optional: (Default = "") :
; $vOption2 - Optional: (Default = "") :
; $bLoadWait - Optional: (Default = true) :
; Return Value ..: Success - Return-value from MozRepl (sometimes an empty string!!!)
; Failure - ""
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 23 11:09:12 CEST 2009
; Link ..........: http://developer.mozilla.org/en/docs/XUL:tabbrowser, http://developer.mozilla.org/en/docs/XUL:Method:reloadWithFlags, https://developer.mozilla.org/En/DOM/Window.scrollBy, http://kb.mozillazine.org/About_Protocol_Links
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFAction($sAction, $vOption = "", $vOption2 = "", $bLoadWait = true)
Local $sFuncName = "_FFAction"
Local $sCommand, $sTemp
Local $sActionL = StringLower($sAction)
Select
Case $sActionL = "back"
$sCommand = "gBrowser.goBack()"
Case $sActionL = "home"
$sCommand = "gBrowser.goHome()"
Case $sActionL = "forward"
$sCommand = "gBrowser.goForward()"
Case $sActionL = "copy"
If $vOption = "" Then $vOption = "|"
For $i = 0 To _FFGetLength("frames") -1
_FFFrameEnter($i)
$sTemp &= _FFCmd(".getSelection()", $_FF_CON_DELAY + 100)
If $sTemp <> "" Then $sTemp &= $vOption
Next
_FFFrameLeave()
$sTemp &= _FFCmd(".getSelection()", $_FF_CON_DELAY + 100)
Return $sTemp
Case $sActionL = "reload" And $vOption <> ""
$sCommand = "gBrowser.reloadWithFlags('" & $vOption & "')"
Case $sActionL = "reload"
$sCommand = "gBrowser.reload()"
Case $sActionL = "fullscreen" Or $sActionL = "fs" And $vOption
$sCommand = "fullScreen=true"
$bLoadWait = False
Case $sActionL = "fullscreen" Or $sActionL = "fs" And Not $vOption
$sCommand = "fullScreen=false"
$bLoadWait = False
Case $sActionL = "minimize" Or $sActionL = "min"
$bLoadWait = False
$sCommand = "minimize()"
Case $sActionL = "maximize" Or $sActionL = "max"
$bLoadWait = False
$sCommand = "maximize()"
Case $sActionL = "restore"
$bLoadWait = False
$sCommand = "restore()"
Case $sActionL = "stop"
$bLoadWait = False
$sCommand = "gBrowser.stop()"
Case $sActionL = "print"
$bLoadWait = False
$sCommand = "content.print()"
Case $sActionL = "find" Or $sActionL = "search"
_FFLoadWait()
$sCommand = "content.find()"
Case $sActionL = "hideall" And $vOption
Return _FFCmd("toggleAffectedChrome(true);")
Case $sActionL = "hideall" And Not $vOption
Return _FFCmd("toggleAffectedChrome(false);")
Case $sActionL = "presentationmode" Or $sActionL = "pm" And $vOption
Return _FFCmd("toggleAffectedChrome(true)" & @CRLF & "fullScreen=true")
Case $sActionL = "presentationmode" Or $sActionL = "pm" And Not $vOption
Return _FFCmd("toggleAffectedChrome(false)" & @CRLF & "fullScreen=false")
Case $sActionL = "alert" And $vOption <> ""
$sCommand = 'alert("' & $vOption & '")'
$bLoadWait = False
Case $sActionL = "chrome" And $vOption <> ""
$sCommand = 'window.content.document.location.href="' & __FFChromeSelect($vOption) & '"'
Case $sActionL = "blank"
$vOption = "blank"
ContinueCase
Case $sActionL = "about"
$sCommand = 'window.content.document.location.href="about:' & $vOption & '"'
Case $sActionL = "scrollxy" And IsInt($vOption) And IsInt($vOption2)
$sCommand = "window.content.scrollBy(" & $vOption & "," & $vOption2 & ");"
$bLoadWait = False
Case $sActionL = "zoom" And $vOption = ""
$vOption = 1
ContinueCase
Case $sActionL = "zoom" And IsNumber($vOption)
$sCommand = "gBrowser.selectedBrowser.markupDocumentViewer.fullZoom=" & $vOption
$bLoadWait = False
Case $sActionL = "resetconsole"
$sCommand = ";" & @CRLF & "repl.home()"
$bLoadWait = False
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "$sAction: " & $sAction & " or " & "$vOption :" & $vOption & " or " & "$vOption2 :" & $vOption2))
Return ""
EndSelect
Local $sRet = _FFCmd($sCommand)
If Not @error Then
If $bLoadWait Then _FFLoadWait()
Return $sRet
Else
SetError(@error)
Return ""
EndIf
EndFunc ;==>_FFAction
; #FUNCTION# ===================================================================
; Name ..........: _FFClick
; Description ...: Simulates a click on an element.
; Beschreibung ..: Simuliert einen Klick auf ein Element.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFClick($sElement[, $sMode = "elements"[, $iIndex = 0]])
; Parameter(s): .: $sElement - Element to click on
; $sMode - Optional: (Default = "elements") :
; | elements
; | id
; | name
; | class
; | tag
; $iIndex - Optional: (Default = 0) : Index if $sMode = elements, name, tag
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 21:18:33 CEST 2009 @846 /Internet Time/
; Link ..........:
; Related .......: _FFClickXY, _FFImageClick, _FFLinkClick, _FFObjGet
; Example .......: Yes
; ==============================================================================
Func _FFClick($sElement, $sMode = "elements", $iIndex = 0)
Local $sFuncName = "_FFClick"
If Not IsInt($iIndex) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iIndex: " & $iIndex))
Return 0
EndIf
Switch StringLower($sMode)
Case "elements"
If StringLeft($sElement, 7) = "OBJECT|" Then $sElement = StringMid($sElement, 8)
Case "id"
$sElement = ".getElementById('" & $sElement & "')"
Case "name"
$sElement = ".getElementsByName('" & $sElement & "')[" & $iIndex & "]"
Case "class"
$sElement = ".getElementsByClassName('" & $sElement & "')[" & $iIndex & "]"
Case "tag"
$sElement = ".getElementsByTagName('" & $sElement & "')[" & $iIndex & "]"
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(elements|id|name|class|tag) $sMode: " & $sMode))
Return 0
EndSwitch
If StringLeft($sElement, 1) = "." Then $sElement = "window.content.document" & $sElement
Local $RetVal = _FFCmd("FFau3.simulateClick(" & $sElement & ",0,0);")
If Not @error And $RetVal <> "_FFCmd_Err" And $RetVal = 1 Then
Sleep(25)
Return $RetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sElement: " & $sElement))
Return 0
EndIf
EndFunc ;==>_FFClick
; #FUNCTION# ===================================================================
; Name ..........: _FFDialogWait
; Description ...: Waits for a browser-dialog-message (e.g. alert) and closes it.
; Beschreibung ..: Wartet auf ein Dialog-Fenster (z.B.: alert) und schließt es.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFDialogWait($sText[, $sTitle = ""[, $sClose = "close"[, $iTimeOut = 10000]]])
; Parameter(s): .: $sText - Text in the dialog (substring)
; $sTitle - Optional: (Default = "") : Window-title of the dialog (substring)
; $bClose - Optional: (Default = "close") :
; | close = Just closes the dialog window
; | open = Do nothing
; | ok = Uses the "ok"-button
; | cancel = Uses the"cancel"-button
; $iTimeOut - Optional: (Default = 10000) : Timeout for waiting (min. 1000ms)
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Apr 14 12:18:08 CEST 2009
; Link ..........:
; Related .......: _FFLoadWait
; Example .......: Yes
; ==============================================================================
Func _FFDialogWait($sText, $sTitle = "", $sClose = "close", $iTimeOut = 10000)
Local $sFuncName = "_FFDialogWait"
If $sTitle = "" And $sText = "" Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "Empty String: $sText and $sTitle"))
Return 0
EndIf
If $sClose = Default Then $sClose = "close"
If $iTimeOut < 1000 Then $iTimeOut = 1000
Local $bFound = False, $b1 = False, $b2 = False
Local $iTimer = TimerInit()
While TimerDiff($iTimer) < $iTimeOut
If _FFCmd('FFau3.obj=Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("").window;' & _
'FFau3.obj.document.documentURI') = "chrome://global/content/commonDialog.xul" Then
If $sTitle <> "" Then
If StringInStr(_FFCmd("FFau3.obj.title"), $sTitle) Then $b1 = True
EndIf
If $sText <> "" Then
If StringInStr(_FFCmd("FFau3.obj.document.documentElement.textContent"), $sText) Then $b2 = True
EndIf
Select
Case $sTitle = "" And $sText <> "" And Not $b1 And $b2
$bFound = True
Case $sTitle <> "" And $sText <> "" And $b1 And $b2
$bFound = True
Case $sTitle <> "" And $sText = "" And $b1 And Not $b2
$bFound = True
Case Else
$bFound = False
EndSelect
If $bFound Then
Switch StringLower($sClose)
Case "close" ; just close the window
_FFCmd("FFau3.obj.close()")
Case "ok"
_FFCmd("FFau3.obj.document.documentElement.acceptDialog()")
Case "cancel"
_FFCmd("FFau3.obj.document.documentElement.cancelDialog()")
Case "open" ; do nothing
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "$sClose: " & $sClose))
Return 0
EndSwitch
Return 1
EndIf
EndIf
Sleep(500)
Wend
SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, Round(TimerDiff($iTimer)) & "ms > " & $iTimeOut & "ms"))
Return 0
EndFunc
; #FUNCTION# ===================================================================
; Name ..........: _FFImageClick
; Description ...: Clicks an image-link.
; Beschreibung ..: Klickt einen Image-Link.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFImageClick($vSearch[, $sMode = "src"[, $bLoadWait = True]])
; Parameter(s): .: $vSearch - Text to search or number (0-n) in index mode
; $sMode - Optional: (Default = "src") :
; | src
; | alt
; | name
; | title
; | id
; | index
; $bLoadWait - Optional: (Default = True) :
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 20:54:44 CEST 2009 @829 /Internet Time/
; Link ..........:
; Related .......: _FFClick, _FFLinkClick
; Example .......: Yes
; ==============================================================================
Func _FFImageClick($vSearch, $sMode = "src", $bLoadWait = True)
Local $sFuncName = "_FFImageClick"
Local $sRegEx
Local $iIndex = -1
$sMode = StringLower($sMode)
Switch $sMode
Case "index"
If Not IsInt($vSearch) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vSearch: " & $vSearch))
Return 0
EndIf
$iIndex = $vSearch
Case "src"
$vSearch = StringRegExpReplace($vSearch, "([\/\.\?\+\=])", "\\$1")
ContinueCase
Case "alt"
ContinueCase
Case "name"
ContinueCase
Case "title"
ContinueCase
Case "id"
$sRegEx = $sMode
$sRegEx = "/" & $sRegEx & "[ \t]*=[ \t]*(.*)" & $vSearch & "/"
$iIndex = _FFCmd("FFau3.searchImageLink(" & $sRegEx & "," & __FFGetStatus() & ")", 10000)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(src|alt|name|title|id|index) $sMode: " & $sMode))
Return 0
EndSwitch
If $iIndex > -1 Then
If _FFClick(".links[" & $iIndex & "]") Then
If $bLoadWait Then Return _FFLoadWait()
Return 1
EndIf
EndIf
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$vSearch: " & $vSearch))
Return 0
EndFunc ;==>_FFImageClick
; #FUNCTION# ===================================================================
; Name ..........: _FFImagesGetBySize
; Description ...: Returns an array with the index of matching images.
; Beschreibung ..: Liefert ein Array mit den Indizes der passenden Bilder.
; Syntax ........: _FFImagesGetBySize($iHeight, $iWidth[, $sMode = "eq"])
; Parameter(s): .: $iHeight - Heigth of the image(s)
; $iWidth - Width of the image(s)
; $sMode - Optional (Default = "eq") :
; | eq
; | lt
; | gt
; Return Value ..: Success - array[0] > 0
; Failure - array[0] = 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 20:00:03 CEST 2009 @791 /Internet Time/
; Link ..........:
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFImagesGetBySize($iHeight, $iWidth, $sMode = "eq")
Local $sFuncName = "_FFImagesGetBySize"
Local $aRet[1] = [0]
If Not IsInt($iHeight) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iHeight: " & $iHeight))
Return $aRet
EndIf
If Not IsInt($iWidth) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iWidth: " & $iWidth))
Return $aRet
EndIf
Switch StringLower($sMode)
Case "eq"
Case "lt"
Case "gt"
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(eq|lt|gt) $sMode: " & $sMode))
Return $aRet
EndSwitch
Local $sCommand = StringFormat("FFau3.SearchImageBySize(%s,%s,'%s',%s);", $iHeight, $iWidth, $sMode, __FFGetStatus())
Local $iIndex = StringStripWS(_FFCmd($sCommand, 10000),3)
$aRet = StringSplit($iIndex," ")
If Not @error And $aRet[0] > 0 Then
For $i = 1 To $aRet[0]
$aRet[$i] = Int($aRet[$i])
Next
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch))
Return $aRet
EndIf
Return $aRet
EndFunc ;==>_FFImagesGetBySize
; #FUNCTION# ===================================================================
; Name ..........: _FFLinkClick
; Description ...: Simulates a click on a link.
; Beschreibung ..: Simuliert einen Klick auf einen Link
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFLinkClick($vSearch[, $sMode = "href"[, $bLoadWait = True]])
; Parameter(s): .: $vSearch - (Sub)String to search or number (0-n) in index mode
; $sMode - Optional: (Default = "href") :
; | href
; | alt
; | name
; | title
; | id
; | index
; $bLoadWait - Optional: (Default = True) :
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 20:50:44 CEST 2009 @826 /Internet Time/
; Link ..........:
; Related .......: _FFClick, _FFImageClick
; Example .......: Yes
; ==============================================================================
Func _FFLinkClick($vSearch, $sMode = "href", $bLoadWait = True)
Local $sFuncName = "_FFLinkClick"
Local $iIndex = -1
$sMode = StringLower($sMode)
Switch $sMode
Case "index"
If Not IsInt($vSearch) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vSearch: " & $vSearch))
Return 0
EndIf
$iIndex = $vSearch
Case "href"
ContinueCase
Case "text"
ContinueCase
Case "name"
ContinueCase
Case "title"
ContinueCase
Case "id"
$iIndex = _FFCmd('FFau3.SearchLink("' & $sMode & '","' & $vSearch & '",' & __FFGetStatus() & ');', 5000)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|href|text|name|title|id) $sMode: " & $sMode))
Return 0
EndSwitch
If $iIndex > -1 Then
If _FFClick(".links[" & $iIndex & "]") Then
If $bLoadWait Then Return _FFLoadWait()
Return 1
EndIf
EndIf
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$vSearch: " & $vSearch))
Return 0
EndFunc ;==>_FFLinkClick
; #FUNCTION# ===================================================================
; Name ..........: _FFFrameGetSelected
; Description ...: Returns the index or label of the currently entered frame
; Beschreibung ..: Gibt das Label oder Index des aktuellen Frames zurück
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFrameGetSelected([$sMode = "index"])
; Parameter(s): .: $sMode - Optional: (Default = "index") :
; | index = returns the index of the frame
; | name = the name of the frame
; Return Value ..: Success - Index or name of the currently entered frame
; Failure - -1 if no frame is selected
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Mon Mar 23 23:26:41 CET 2009 @976 /Internet Time/
; Link ..........:
; Related .......: _FFFrameLeave, _FFFrameEnter
; Example .......: Yes
; ==============================================================================
Func _FFFrameGetSelected($sMode = "index")
Local $sFuncName = "_FFFrameGetSelected"
Local $iIndex = __FFGetStatus()
Switch StringLower($sMode)
Case "index"
Return $iIndex
Case "name"
Local $RetVal = _FFCmd('content.frames[' & $iIndex & '].name')
If $RetVal = "" Then Return -1
Return $RetVal
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name) $sMode: " & $sMode))
Return -1
EndSwitch
Return -1
EndFunc ;==>_FFFrameGetSelected
; #FUNCTION# ===================================================================
; Name ..........: _FFFrameLeave
; Description ...: Leaves the currently entered frame
; Beschreibung ..: Verläßt den aktuellen Frame
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFrameLeave()
; Parameter(s): .:
; Return Value ..: Success - 1
; Failure - 0
; Author(s) .....: Thorsten Willert
; Date ..........: Mon Mar 23 23:26:09 CET 2009 @976 /Internet Time/
; Link ..........:
; Related .......: _FFFrameEnter, _FFFrameGetSelected
; Example .......: Yes
; ==============================================================================
Func _FFFrameLeave()
;Local $sFuncName = "_FFFrameLeave"
Return __FFSetStatus(-1)
EndFunc ;==>_FFFrameLeave
; #FUNCTION# ===================================================================
; Name ..........: _FFFrameEnter
; Description ...: Selects a frame, which all subsequent commands apply on.
; Beschreibung ..: Wählt einen Frame aus, auf den alle nachfolgenden Befehle wirken.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFrameEnter($vFrame[, $sMode = "index"])
; Parameter(s): .: $vFrame - Frame name or id or number in index mode
; $sMode - Optional: (Default = "index") :
; | name
; | id
; | index
; Return Value ..: Success - 1
; @extended - Index of the entered frame (-1 if top or parent)
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert & Johannes Schirmer
; Date ..........: Fri Sep 04 10:33:57 CEST 2009 @398 /Internet Time/
; Link ..........:
; Related .......: _FFFrameLeave, _FFFrameGetSelected
; Example .......: Yes
; ==============================================================================
Func _FFFrameEnter($vFrame, $sMode = "index")
Local $sFuncName = "_FFFrameEnter"
Local $iLength = _FFGetLength("frames")
If $iLength = 0 Then
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "No frames found."))
Return 0
EndIf
Local $sArg, $i
$sMode = StringLower($sMode)
Switch $sMode
Case "index"
$sArg = "content.frames[" & $vFrame & "]"
Case "name" Or "id"
$sArg = 'content.frames["' & $vFrame & '"]'
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name) $sMode: " & $sMode))
Return 0
EndSwitch
If _FFFrameGetSelected() > -1 Then _FFFrameLeave()
If $sMode = "index" Then
_FFCmd($sArg & ".document.location.href")
If Not @error Then
__FFSetStatus($vFrame)
SetExtended($vFrame)
Return 1
EndIf
Else
If StringInStr("parent top", $vFrame) Then
__FFSetStatus(-1)
SetExtended(-1)
Return 1
EndIf
For $i = 0 To $iLength - 1
If _FFCmd("content.frames[" & $i & "]." & $sMode, 3000) = $vFrame Then
__FFSetStatus($i)
SetExtended($i)
Return 1
EndIf
Next
EndIf
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$vFrame: " & $vFrame))
Return 0
EndFunc ;==>_FFFrameEnter
; #FUNCTION# ===================================================================
; Name ..........: _FFGetLength
; Description ...: Returns the length of the elements in $sMode
; Beschreibung ..: Gibt die Anzahl der angegebenen Elemente zurück.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFGetLength([$sMode = "links"])
; Parameter(s): .: $sMode - Optional: (Default = "links") :
; | links
; | images
; | forms
; | frames
; | anchors
; | tables
; | styleSheets
; | tabs
; | history
; | applets
; | embeds
; | plugins
; | tag
; Return Value ..: Success - Length of the elements
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Mon Mar 23 23:24:13 CET 2009 @975 /Internet Time/
; Link ..........:
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFGetLength($sMode = "links")
Local $sFuncName = "_FFGetLength"
$sMode = StringLower($sMode)
Switch $sMode
Case "links"
ContinueCase
Case "images"
ContinueCase
Case "forms"
ContinueCase
Case "anchors"
ContinueCase
Case "applets"
ContinueCase
Case "embeds"
Return _FFCmd("." & $sMode & ".length")
Case "tabs"
Return _FFCmd("gBrowser.tabContainer.childNodes.length")
Case "frames"
Return _FFCmd("content.frames.length")
Case "tables"
Return _FFCmd(".getElementsByTagName('table').length")
Case "history"
Return _FFCmd("content.history.length")
Case "stylesheets"
Return _FFCmd(".styleSheets.length")
Case "plugins"
Return _FFCmd("navigator.plugins.length")
Case Else
Local $RetVal = _FFCmd(".getElementsByTagName('" & $sMode & "').length;")
If Not @error And $RetVal <> "_FFCmd_Err" Then
Return $RetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sMode: " & $sMode))
Return 0
EndIf
EndSwitch
Return 0
EndFunc ;==>_FFGetLength
; #FUNCTION# ===================================================================
; Name ..........: _FFLinksGetAll
; Description ...: Returns an array with informations about all existing links.
; Beschreibung ..: Gibt ein Array mit Informationen über alle vorhandenen Links zurück.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFLinksGetAll()
; Parameter(s): .:
; 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] = 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 16 09:34:25 CEST 2009
; Link ..........:
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFLinksGetAll()
Local $sFuncName = "_FFLinksGetAll"
Local $aInfo, $sInfo, $aRet[1][9], $aTmp
Local $sDelimiter
If _FFGetLength() > 0 Then
$sDelimiter = "FF" & Random(1000, 9999, 1)
$sInfo = _FFCmd('FFau3.GetLinks(' & _FFFrameGetSelected() & ',"' & $sDelimiter & '");')
$aInfo = StringSplit($sInfo, @CRLF)
If @error Then
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch))
Return $aRet[0][0] = 0
EndIf
ReDim $aRet[$aInfo[0] - 1][9]
For $i = 1 To $aInfo[0] - 1
$aTmp = StringSplit($aInfo[$i], $sDelimiter, 1)
If @error Then
SetError(__FFError($sFuncName, $_FF_ERROR_RetValue, "StringSplit: " & $aInfo[$i]))
ExitLoop
EndIf
If UBound($aTmp) <> 11 Then
$sDelimiter = "FF" & Random(1000, 9999, 1)
$sInfo = _FFCmd("FFau3.GetLinkInfo(" & $i & " ,'top','" & $sDelimiter & "')")
$aTmp = StringSplit($sInfo, $sDelimiter, 1)
EndIf
For $j = 1 To $aTmp[0] - 1
$aRet[$i - 1][$j - 1] = $aTmp[$j]
Next
Next
Return $aRet
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch))
$aRet[0][0] = 0
EndIf
SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError))
Return $aRet[0][0] = 0
EndFunc ;==>_FFLinksGetAll
; #FUNCTION# ===================================================================
; Name ..........: _FFConnect
; Description ...: Connects to FireFox / MozRepl
; Beschreibung ..: Stellt eine Verbindung mit Firefox / MozRepl her.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFConnect([$IP = "127.0.0.1"[, $iPort = 4242[, $iTimeOut = 60000]]])
; Parameter(s): .: $IP - Optional: (Default = "127.0.0.1") :
; $iPort - Optional: (Default = 4242) :
; $iTimeOut - Optional: (Default = 60000) :
; Return Value ..: Success - 1 / $_FF_GLOBAL_SOCKET > -1
; @EXTENDED - 1 = Non Browser-window
; | 2 = Browser-window
; Failure - 0 / $_FF_GLOBAL_SOCKET = -1
; @ERROR -
; @EXTENDED - 0
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Aug 18 09:36:57 CEST 2009
; Link ..........: http://msdn.microsoft.com/en-us/library/ms740668(VS.85).aspx
; Related .......: _FFDisConnect, _FFIsConnected, _FFStart
; Example .......: Yes
; ==============================================================================
Func _FFConnect($IP = "127.0.0.1", $iPort = 4242, $iTimeOut = 60000)
Local $sFuncName = "_FFConnect"
Local $Extended = 2
If $_FF_CON_DELAY > 100 Then Opt("TCPTimeout", $_FF_CON_DELAY)
If $IP = Default Then $IP = "127.0.0.1"
If $iPort = Default Then $iPort = 4242
If $iTimeOut = Default Then $iTimeOut = 60000
If Not __FFIsIP($IP) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, $IP))
Return 0
EndIf
If Not __FFIsPort($iPort) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, $iPort))
Return 0
EndIf
Local $iTCPErr
Local $bTrace = $_FF_COM_TRACE
;$_FF_COM_TRACE = false
ConsoleWrite("_FFConnect: OS:" & @TAB & @OSVersion & " " & @OSTYPE & " " & @OSBuild & " " & @OSServicePack & @CRLF)
ConsoleWrite("_FFConnect: AutoIt:" & @TAB & @AutoItVersion & @CRLF)
ConsoleWrite("_FFConnect: FF.au3:" & @TAB & $_FF_AU3VERSION & @CRLF)
ConsoleWrite("_FFConnect: IP:" & @TAB & $IP & @CRLF)
ConsoleWrite("_FFConnect: Port:" & @TAB & $iPort & @CRLF)
TCPStartup()
If Not @error Then
; delay for connection over network
$_FF_CON_DELAY = Ping($IP)
If @error Then
SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Ping Error: " & @error))
$_FF_CON_DELAY = $_FF_COM_DELAY_MAX
EndIf
$_FF_CON_DELAY += Round($_FF_CON_DELAY * 0.5)
ConsoleWrite("_FFConnect: Delay: " & @TAB & $_FF_CON_DELAY & "ms" & @CRLF)
; trying to connect
Local $iTimeOutTimer = TimerInit()
While 1
$_FF_GLOBAL_SOCKET = TCPConnect($IP, $iPort)
$iTCPErr = @error
Sleep(500)
If __FFIsSocket($_FF_GLOBAL_SOCKET) Then ExitLoop
If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then ; Profil laden
SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, "TCPConnect Error: " & $iTCPErr ))
$_FF_GLOBAL_SOCKET = -1
ExitLoop
EndIf
WEnd
If $_FF_GLOBAL_SOCKET <> -1 Then
ConsoleWrite("_FFConnect: Socket: " & @TAB & $_FF_GLOBAL_SOCKET & @CRLF)
If __FFWaitForRepl(10000) Then
__FFAddStatus()
_FFCmd(".browserDOMWindow")
If @error Then
SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Warning: Connected to a non browser-window" ))
$Extended = 1
EndIf
ConsoleWrite("_FFConnect: Browser:" & @TAB & _FFCmd("navigator.userAgent") & @CRLF)
__FFSendJavaScripts()
$_FF_COM_TRACE = $bTrace
Return SetError(0, $Extended, 1)
EndIf
Else
TCPShutdown()
$_FF_COM_TRACE = $bTrace
Return SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Timeout: Can not connect to FireFox/MozRepl on: " & $IP & ":" & $iPort ), 0, 0)
EndIf
Else
$_FF_COM_TRACE = $bTrace
Return SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "TCPStartup Error: " & @error), 0, 0)
EndIf
$_FF_COM_TRACE = $bTrace
Return SetError($_FF_ERROR_GeneralError, $Extended, 0)
EndFunc ;==>_FFConnect
; #FUNCTION# ===================================================================
; Name ..........: _FFDisConnect
; Description ...: Disconnects from FireFox
; Beschreibung ..: Trennt die Verbindung mit FireFox / MozRepl
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFDisConnect()
; Parameter(s): .:
; Return Value ..: Success - 1 / $_FF_GLOBAL_SOCKET = -1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Wed Apr 15 09:54:09 CEST 2009
; Link ..........: http://msdn.microsoft.com/en-us/library/ms740668(VS.85).aspx
; Related .......: _FFConnect, _FFIsConnected, _FFStart
; Example .......: Yes
; ==============================================================================
Func _FFDisConnect()
Local $sFuncName = "_FFDisConnect"
Opt("TCPTimeout", 200)
If __FFIsSocket($_FF_GLOBAL_SOCKET) Then
__FFSend("repl.quit()")
TCPCloseSocket($_FF_GLOBAL_SOCKET)
If @error Then
SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "TCP Error: " & @error))
Return 0
EndIf
TCPShutdown()
If Not @error Then
If $_FF_COM_TRACE Then ConsoleWrite("_FFDisConnect: disconnected" & @CRLF)
__FFRemoveStatus()
$_FF_GLOBAL_SOCKET = -1
Return 1
Else
SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "TCP Error: " & @error))
Return 0
EndIf
Else
SetError(__FFError($sFuncName, $_FF_ERROR_SocketError, $_FF_GLOBAL_SOCKET))
Return 0
EndIf
EndFunc ;==>_FFDisConnect
; #FUNCTION# ===================================================================
; Name ..........: _FFIsConnected
; Description ...: Connection status to FireFox / MozRepl
; Beschreibung ..: Liefert den Status der Verbindung mit FireFox / MozRepl
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFIsConnected()
; Parameter(s): .:
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Apr 07 11:11:05 CEST 2009 @424 /Internet Time/
; Link ..........:
; Related .......: _FFConnect, _FFDisConnect, _FFStart
; Example .......: Yes
; ==============================================================================
Func _FFIsConnected()
Local $sFuncName = "_FFIsConnected"
If __FFIsSocket($_FF_GLOBAL_SOCKET) Then
If _FFCmd("FFau3 != null?1:0") = 1 Then Return 1
EndIf
SetError(__FFError($sFuncName, $_FF_ERROR_SocketError, $_FF_GLOBAL_SOCKET))
Return 0
EndFunc ;==> _FFIsConnected
; #FUNCTION# ===================================================================
; Name ..........: _FFFormCheckBox
; Description ...: Checks or unchecks a CheckBox in a form.
; Beschreibung ..: Wählt eine Checkbox an oder ab.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormCheckBox($vBox[, $bChecked = True[, $iBoxNameIndex = 0[, $sBoxMode = "index"[, $vForm = 0[, $sFormMode = "index"[, $bCheckBox = True]]]]]])
; Parameter(s): .: $vBox - Index name, id or value of the CheckBox
; $bChecked - Optional: (Default = True) :
; | True
; | False
; $iBoxNameIndex - Optional: (Default = 0) : Index if $sBoxMode = "name"
; $sBoxMode - Optional: (Default = "index") :
; | index
; | name
; | id
; | value
; $vForm - Optional: (Default = 0) : Index, name or id of the Form
; $sFormMode - Optional: (Default = "index") :
; | index
; | name
; | id
; $bCheckBox - Optional: (Default = True) : Internal use if the function should work for RadioButtons
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Wed Mar 25 09:25:43 CET 2009 @392 /Internet Time/
; Link ..........:
; Related .......: _FFFormOptionSelect, _FFFormRadioButton, _FFFormReset, _FFFormSubmit
; Example .......: Yes
; ==============================================================================
Func _FFFormCheckBox($vBox, $bChecked = True, $iBoxNameIndex = 0, $sBoxMode = "index", $vForm = 0, $sFormMode = "index" , $bCheckBox = True)
Local $sFuncName = "_FFFormCheckBox"
; Default parameters
;If $bChecked = Default Then $bChecked = true
If $iBoxNameIndex = Default Then $iBoxNameIndex = 0
If $sBoxMode = Default Then $sBoxMode = "index"
If $vForm = Default Then $vForm = 0
If $sFormMode = Default Then $sFormMode = "index"
Local $sType
If $bCheckBox Then
$sType = "checkbox"
Else
$sType = "radio"
EndIf
$sBoxMode = StringLower($sBoxMode)
$sFormMode = StringLower($sFormMode)
If Not IsBool($bChecked) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(bool) $bChecked: " & $bChecked))
Return 0
EndIf
Local $sCommand = "checked=" & __FFB2S($bChecked)
Local $sForm, $sCheckBox
Switch $sFormMode
Case "index"
If Not IsInt($vForm) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vForm: " & $vForm))
Return 0
EndIf
$sForm = $vForm + 1
Case "name"
ContinueCase
Case "id"
$sForm = StringFormat("@%s='%s'", $sFormMode, $vForm)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name|id) $sFormMode: " & $sFormMode))
Return 0
EndSwitch
Switch $sBoxMode
Case "index"
If Not IsInt($vBox) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vBox: " & $vBox))
Return 0
EndIf
$sCheckBox = "position()=" & $vBox + 1
Case "name"
If Not IsInt($iBoxNameIndex) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iBoxNameIndex: " & $iBoxNameIndex))
Return 0
EndIf
$sCheckBox = StringFormat("@name='%s' and position()=%i", $vBox, $iBoxNameIndex + 1)
Case "id"
ContinueCase
Case "value"
$sCheckBox = StringFormat("@%s='%s'", $sBoxMode, $vBox)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name|id|value) $sBoxMode: " & $sBoxMode))
Return 0
EndSwitch
_FFXPath(StringFormat("//form[%s]//input[@type='%s' and %s]", $sForm, $sType, $sCheckBox), $sCommand, 9)
If Not @error Then
Return 1
Else
SetError(@error)
Return 0
EndIf
EndFunc ;==>_FFFormCheckBox
; #FUNCTION# ===================================================================
; Name ..........: _FFFormGetLength
; Description ...: Length of the forms
; Beschreibung ..: Gibt die Anzahl der Formulare zurück.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormGetLength()
; Parameter(s): .:
; Return Value ..: Success - >0
; Failure - 0
; Author(s) .....: Thorsten Willert
; Date ..........: Mon Mar 23 23:15:23 CET 2009 @969 /Internet Time/
; Link ..........:
; Related .......: _FFGetLength
; Example .......: Yes
; ==============================================================================
Func _FFFormGetLength()
;Local $sFuncName = "_FFFormGetLength"
Return _FFGetLength("forms")
EndFunc ;==>_FFFormGetLength
; #FUNCTION# ===================================================================
; Name ..........: _FFFormGetElementsLength
; Description ...: Length of the form elements
; Beschreibung ..: Gibt die Anzahl der Elemente eines Formulars zurück.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormGetElementsLength([$vForm = 0[, $sMode = "index"[, $sCount = "DOM"]]])
; Parameter(s): .: $vForm - Optional: (Default = 0) : Index (0-n), name or id
; $sMode - Optional: (Default = "index") :
; | index
; | name
; | id
; $sCount - Optional: (Default = "DOM") :
; | DOM = are not counted
; Return Value ..: Success - >0
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Fri Apr 10 12:06:30 CEST 2009
; Link ..........:
; Related .......: _FFFormGetLength, _FFGetLength
; Example .......: Yes
; ==============================================================================
Func _FFFormGetElementsLength($vForm = 0, $sMode = "index", $sCount = "DOM")
Local $sFuncName = "_FFFormGetElementsLength"
Local $sForm, $sInput
If $vForm = Default Then $vForm = 0
If $sMode = Default Then $sMode = "index"
$sCount = StringLower($sCount)
Switch StringLower($sMode)
Case "index"
If IsInt($vForm) Then
$sForm = $vForm +1
Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vForm: " & $vForm))
Return 0
EndIf
Case "name"
$sForm = "@name='" & $vForm & "'"
Case "id"
$sForm = "@id='" & $vForm & "'"
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name|id) $vForm: " & $vForm))
Return 0
EndSwitch
If $sCount = "dom" Then
$sInput = "input[@type!='image']"
Else
$sInput = "input"
EndIf
Local $bTrace = $_FF_COM_TRACE
$_FF_COM_TRACE = False
Local $c = _FFXPath(StringFormat("//form[%s]//%s", $sForm, $sInput), "", 10)
If Not @error Then
$c += _FFXPath(StringFormat("//form[%s]//textarea", $sForm), "", 10)
$c += _FFXPath(StringFormat("//form[%s]//select", $sForm), "", 10)
$c += _FFXPath(StringFormat("//form[%s]//fieldset", $sForm), "", 10)
$_FF_COM_TRACE = $bTrace
Return $c
Else
$_FF_COM_TRACE = $bTrace
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$vForm: " & $vForm))
Return 0
EndIf
EndFunc ;==>_FFFormGetElementsLength
; #FUNCTION# ===================================================================
; Name ..........: _FFFormOptionSelect
; Description ...: Selects an element of an OptionSelect.
; Beschreibung ..: Wählt ein Element eines OptionSelect aus.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormOptionSelect([$vElement = 0[, $sElementMode = "index"[, $vOption = 0[, $sOptionMode = "index"[, $vForm = 0[, $sFormMode = "index"]]]]]])
; Parameter(s): .: $vElement - Optional: (Default = 0) : index (0-n), name, id
; $sElementMode - Optional: (Default = "index") :
; | index
; | name
; | id
; $vOption - Optional: (Default = 0) : index (0-n), name, id, text, value
; $sOptionMode - Optional: (Default = "index") :
; | index
; | name
; | id
; | text
; | value
; $vForm - Optional: (Default = 0) : index (0-n), name, id
; $sFormMode - Optional: (Default = "index") :
; | index
; | name
; | id
; Return Value ..: Success - 1
; Failure - 0 and sets
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Wed Mar 25 09:27:49 CET 2009 @394 /Internet Time/
; Link ..........:
; Related .......: _FFFormCheckBox, _FFFormRadioButton, _FFFormReset, _FFFormSubmit
; Example .......: Yes
; ==============================================================================
Func _FFFormOptionSelect($vElement = 0, $sElementMode = "index", $vOption = 0, $sOptionMode = "index", $vForm = 0, $sFormMode = "index")
Local $sFuncName = "_FFFormOptionSelect"
; Default parameters
If $vElement = Default Then $vElement = 0
If $sElementMode = Default Then $sElementMode = "index"
If $vOption = Default Then $vOption = 0
If $sOptionMode = Default Then $sOptionMode = "index"
If $vForm = Default Then $vForm = 0
If $sFormMode = Default Then $sFormMode = "index"
Local $sForm, $sElement, $sOption
$sElementMode = StringLower($sElementMode)
$sOptionMode = StringLower($sOptionMode)
$sFormMode = StringLower($sFormMode)
Switch $sFormMode
Case "index"
If Not IsInt($vForm) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vForm: " & $vForm))
Return 0
EndIf
$sForm = $vForm + 1
Case "name"
ContinueCase
Case "id"
$sForm = StringFormat("@%s='%s'", $sFormMode, $vForm)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name|id) $sFormMode: " & $sFormMode))
Return 0
EndSwitch
Switch $sElementMode
Case "index"
If Not IsInt($vElement) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vElement: " & $vElement))
Return 0
EndIf
$sElement = "position()=" & $vElement + 1
Case "name"
ContinueCase
Case "id"
$sElement = StringFormat("@%s='%s'", $sElementMode, $vElement)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|name|id) $sElementMode: " & $sElementMode))
Return 0
EndSwitch
Switch $sOptionMode
Case "index"
If Not IsInt($vOption) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vOption: " & $vOption))
Return 0
EndIf
$sOption = "position()=" & $vOption + 1
Case "text"
$sOption = StringFormat("contains(.,'%s')", $vOption)
Case "name"
ContinueCase
Case "value"
ContinueCase
Case "id"
$sOption = StringFormat("@%s='%s'", $sOptionMode, $vOption)
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|text|name|id|value) $sOptionMode: " & $sOptionMode))
Return 0
EndSwitch
Local $sCommand = StringFormat("//form[%s]//select[%s]//option[%s]", $sForm, $sElement, $sOption)
_FFXPath($sCommand, "selected=true", 9)
If Not @error Then
Return 1
Else
SetError(@error)
Return 0
EndIf
EndFunc ;==>_FFFormOptionSelect
; #FUNCTION# ===================================================================
; Name ..........: _FFFormRadioButton
; Description ...: Selects a RadioButton in a form
; Beschreibung ..: Wählt ein RadioButton aus.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormRadioButton($vRadioButton[, $iRadioButtonIndex = 0[, $sRadioButtonMode = "index"[, $vForm = 0[, $sFormMode = "index"]]]])
; Parameter(s): .: $vRadioButton - name, id or value
; $iRadioButtonIndex - Optional: (Default = 0) : RadioButton index (0-n)
; $sRadioButtonMode - Optional: (Default = "index") : RadioButton
; | index
; | name
; | id
; | value
; $vForm - Optional: (Default = 0) : Form index or name
; $sFormMode - Optional: (Default = "index") :
; | index
; | name
; Return Value ..: Success - RadioButton state 1 or 0
; Failure - -1
; Author(s) .....: Thorsten Willert
; Date ..........: Wed Mar 25 09:22:11 CET 2009 @390 /Internet Time/
; Link ..........:
; Related .......: _FFFormCheckBox, _FFFormOptionSelect, _FFFormReset, _FFFormSubmit
; Example .......: Yes
; ==============================================================================
Func _FFFormRadioButton($vRadioButton, $iRadioButtonIndex = 0, $sRadioButtonMode = "index", $vForm = 0, $sFormMode = "index")
;Local $sFuncName = "_FFFormRadioButton"
Local $RetVal = _FFFormCheckBox($vRadioButton, True, $iRadioButtonIndex, $sRadioButtonMode, $vForm, $sFormMode , False)
SetError(@error)
Return $RetVal
EndFunc ;==>_FFFormRadioButton
; #FUNCTION# ===================================================================
; Name ..........: _FFFormReset
; Description ...: Resets a form
; Beschreibung ..: Setzt ein Formular zurück.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormReset([$vForm = 0[, $sMode = "index"]])
; Parameter(s): .: $vForm - Optional: (Default = 0) : Index (0-n), name, id
; $sMode - Optional: (Default = "index") :
; | Index
; | name
; | id
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Apr 07 18:08:06 CEST 2009 @713 /Internet Time/
; Link ..........:
; Related .......: _FFFormCheckBox, _FFFormOptionSelect, _FFFormSubmit, _FFFormRadioButton
; Example .......: Yes
; ==============================================================================
Func _FFFormReset($vForm = 0, $sMode = "index")
Local $sFuncName = "_FFFormReset"
Local $sCommand
Switch StringLower($sMode)
Case "index"
If Not IsInt($vForm) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vForm: " & $vForm))
Return 0
EndIf
$sCommand = 'forms[' & $vForm & ']'
Case "id"
$sCommand = 'getElementById("' & $vForm & '")'
Case "name"
$sCommand = 'getElementsByName("' & $vForm & '")[0]'
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|id|name) $sMode: " & $sMode))
Return 0
EndSwitch
$sCommand = StringFormat('window.content.document.%s.reset();', $sCommand)
Local $sRetVal = _FFCmd($sCommand)
If Not @error And $sRetVal <> "_FFCmd_Err" Then Return 1
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$vForm: " & $vForm))
Return 0
EndFunc ;==>_FFFormReset
; #FUNCTION# ===================================================================
; Name ..........: _FFFormSubmit
; Description ...: Submits a form
; Beschreibung ..: Sendet ein Formular ab.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFFormSubmit([$vForm = 0[, $sMode = "index"[, $sSubmitMode = "submit"[, $bLoadWait = True]]]])
; Parameter(s): .: $vForm - Optional: (Default = 0) : Index-number, name or id
; $sSubmitMode - Optional: (Default = "auto") :
; | auto
; | click
; | submit
; | keydown
; | keypress
; $bLoadWait - Optional: (Default = true) :
; | True
; | False
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Apr 07 17:56:46 CEST 2009 @706 /Internet Time/
; Link ..........:
; Related .......: _FFFormCheckBox, _FFFormOptionSelect, _FFFormReset, _FFFormRadioButton
; Example .......: Yes
; ==============================================================================
Func _FFFormSubmit($vForm = 0, $sMode = "index", $sSubmitMode = "submit", $bLoadWait = True)
Local $sFuncName = "_FFFormSubmit"
Local $sRetVal
Local $iSubmit = -1, $iPassword = -1
Local $bTrace
$sMode = StringLower($sMode)
If $sMode = "index" Then
If IsInt($vForm) Then
$vForm = 'forms[' & $vForm & ']'
Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vForm: " & $vForm))
Return 0
EndIf
ElseIf $sMode = "id" Then
$vForm = "getElementById('" & $vForm & "')"
ElseIf $sMode = "name" Then
$vForm = "getElementsByName('" & $vForm & "')[0]"
Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(index|id|name) $sMode: " & $sMode))
Return 0
EndIf
Local $iLength = _FFCmd(StringFormat('.%s.elements.length;', $vForm))
If $iLength = "_FFCmd_Err" Then
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "No Elements found in form: " & $vForm))
Return 0
EndIf
$bTrace = $_FF_COM_TRACE
$_FF_COM_TRACE = False
If $iLength > 0 And ($sSubmitMode = "keypress" Or $sSubmitMode = "keydown" Or $sSubmitMode = "click" Or $sSubmitMode = "auto") Then
For $i = 0 To $iLength - 1
$sRetVal = _FFCmd(StringFormat('.%s.elements[%i].type;', $vForm, $i))
If @error Then Return 0
If $sRetVal = "submit" Then $iSubmit = $i
If $sRetVal = "password" Then $iPassword = $i
If $iSubmit > -1 And $iPassword > -1 Then ExitLoop
Next
EndIf
$_FF_COM_TRACE = $bTrace
Switch StringLower($sSubmitMode)
Case "auto"
ContinueCase
Case "keypress"
; fire "enter" with keypress on the password element
_FFDispatchKeyEvent(StringFormat('.%s.elements[%i]', $vForm, $iPassword), 13, "keypress")
If Not @error Then
If $bLoadWait Then
If Not _FFLoadWait() Then Return 0
EndIf
Return 1
Else
If $sSubmitMode = "auto" Then ContinueCase
EndIf
Case "click"
; clicks on the submit element
$sRetVal = _FFCmd(StringFormat('.%s.elements[%i].click();', $vForm, $iSubmit), 3000)
If Not @error And $sRetVal <> "_FFCmd_Err" Then
If $bLoadWait Then
If Not _FFLoadWait() And $sSubmitMode = "auto" Then ContinueCase
EndIf
Return 1
Else
If $sSubmitMode = "auto" Then ContinueCase
EndIf
Case "submit"
; use form.submit()
$sRetVal = _FFCmd(StringFormat('.%s.submit();', $vForm))
If Not @error And $sRetVal <> "_FFCmd_Err" Then
If $bLoadWait Then
If Not _FFLoadWait() And $sSubmitMode = "auto" Then ContinueCase
EndIf
Return 1
Else
If $sSubmitMode = "auto" Then ContinueCase
EndIf
Case "keydown"
; fire "enter" with keydown on the password element
_FFDispatchKeyEvent(StringFormat(".%s.elements[%i]", $vForm, $iPassword), 13)
If Not @error Then
If $bLoadWait Then
If Not _FFLoadWait() And $sSubmitMode = "auto" Then ContinueCase
EndIf
Return 1
EndIf
Case Else
Return 0
EndSwitch
Return 0
EndFunc ;==>_FFFormSubmit
; #FUNCTION# ===================================================================
; Name ..........: _FFGetValueById
; Description ...: Gets an value of an element by ID
; Beschreibung ..: Liefert ein Value anhand der Element-Id
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFGetValueById($sID[, $iFilter = 0])
; Parameter(s): .: $sID - ID of the element
; $iFilter - Optional: (Default = 0) : you can add them:
; | 0 = No filter
; | 1 = Remove all non ASCII
; | 2 = Remove all double withespaces
; | 4 = Remove all double linefeeds
; | 8 = Remove all HTML-tags
; | 16 = simple html-tag / entities convertor
; Return Value ..: Success - Value
; Failure - ""
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 15:16:22 CEST 2009 @594 /Internet Time/
; Link ..........:
; Related .......: _FFGetValueByName, _FFSetValueById, _FFSetValueByName, _FFXPath
; Example .......: Yes
; ==============================================================================
Func _FFGetValueById($sID, $iFilter = 0)
Local $sFuncName = "_FFGetValueById"
If $sID = "" Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "Empty String: $sID"))
Return ""
EndIf
If Not IsInt($iFilter) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iFilter: " & $iFilter))
Return ""
EndIf
Local $sRndErr = "_FFGetValueById_Error"
Local $sElement = "content.document.getElementById('" & $sID & "')"
Local $sRetVal = _FFCmd(StringFormat("(%s != null ? %s.value : '%s');", $sElement, $sElement, $sRndErr), 3000)
If $sRetVal <> $sRndErr Then
If $iFilter > 0 Then __FFFilterString($sRetVal, $iFilter)
Return $sRetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sID: " & $sID))
Return ""
EndIf
EndFunc ;==>_FFGetValueById
; #FUNCTION# ===================================================================
; Name ..........: _FFGetValueByName
; Description ...: Gets a value of an element by name.
; Beschreibung ..: Liefert ein Value anhand des Element-Namens
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFGetValueByName($sName[, $iIndex = 0[, $iFilter = 0]])
; Parameter(s): .: $sName - Name of the element
; $iIndex - Optional: (Default = 0) : Index of the element (0-n)
; $iFilter - Optional: (Default = 0) : you can add them:
; | 0 = No filter
; | 1 = Remove all non ASCII
; | 2 = Remove all double withespaces
; | 4 = Remove all double linefeeds
; | 8 = Remove all HTML-tags
; | 16 = simple html-tag / entities convertor
; Return Value ..: Success - Value
; Failure - ""
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 15:14:25 CEST 2009 @593 /Internet Time/
; Link ..........:
; Related .......: _FFGetValueById, _FFSetValueById, _FFSetValueByName, _FFXPath
; Example .......: Yes
; ==============================================================================
Func _FFGetValueByName($sName, $iIndex = 0, $iFilter = 0)
Local $sFuncName = "_FFGetValueByName"
If $sName = "" Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "Empty String: $sName"))
Return ""
EndIf
If Not IsNumber($iIndex) Or $iIndex < 0 Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(int) >= 0 $iIndex: " & $iIndex))
Return ""
EndIf
If Not IsInt($iFilter) Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iFilter: " & $iFilter))
Return ""
EndIf
Local $sRndErr = "_FFGetValueByName_Error"
Local $sElement = "content.document.getElementsByName('" & $sName & "')[" & $iIndex & "]"
Local $sRetVal = _FFCmd(StringFormat("(%s != null ? %s.value : '%s');", $sElement, $sElement, $sRndErr), 3000)
If $sRetVal <> $sRndErr Then
If $iFilter > 0 Then __FFFilterString($sRetVal, $iFilter)
Return $sRetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, $sName))
Return ""
EndIf
EndFunc ;==>_FFGetValueByName
; #FUNCTION# ===================================================================
; Name ..........: _FFDispatchKeyEvent
; Description ...: Simulates a key-event on an element.
; Beschreibung ..: Simuliert ein Tastatur-Ereignis an einem Element.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFDisPatchKeyEvent($sObject, $iKeyCode[, $sEventType = "keydown"])
; Parameter(s): .: $sElement - Element where the keyevent is fired
; $iKeyCode - ASCII-KeyCode (decimal)
; $sEventType - Optional: (Default = "keydown") :
; | keydown
; | keypress
; | keyup
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Fri Sep 04 11:24:01 CEST 2009 @433 /Internet Time/
; Link ..........:
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFDispatchKeyEvent($sElement, $iKeyCode, $sEventType = "keypress")
Local $sFuncName = "_FFDispatchKeyEvent"
If $iKeyCode < 0 Or $iKeyCode > 255 Then
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(int) $iKeyCode: 0-255" & $iKeyCode))
Return 0
EndIf
$sEventType = StringLower($sEventType)
If StringLeft($sElement, 7) = "OBJECT|" Then $sElement = StringMid($sElement, 8)
Switch $sEventType
Case "keydown"
Case "keypress"
Case "keyup"
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(keydown|keypress|keyup) $sEventType: " & $sEventType))
Return 0
EndSwitch
If StringLeft($sElement, 1) = "." Then $sElement = "content.frames[" & __FFGetStatus() & "].document" & $sElement
Local $RetVal = _FFCmd("FFau3.simulateKey(" & $sElement & "," & $iKeyCode & ", '" & $sEventType & "');")
If Not @error And $RetVal <> "_FFCmd_Err" Then
Return $RetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "$sElement: " & $sElement))
Return 0
EndIf
Return 0
EndFunc ;==>_FFDispatchKeyEvent
; #FUNCTION# ===================================================================
; Name ..........: _FFDispatchEvent
; Description ...: Simulates a HTML event
; Beschreibung ..: Simuliert ein HTML-Ereignis an einem Element.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFDispatchEvent($sElement[, $sEventType = "change"])
; Parameter(s): .: $sElement - Element where the event is fired (or object from _FFXpath/_FFObj*)
; $sEventType - Optional: (Default = "change") :
; | change
; | select
; | focus
; | blur
; | resize
; Return Value ..: Success - 1
; Failure - 0
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Fri Aug 21 20:32:39 CEST 2009
; Link ..........: http://www.w3.org/TR/DOM-Level-2-Events/events.html
; Related .......: _FFDispatchKeyEvent
; Example .......: Yes
; ==============================================================================
Func _FFDispatchEvent($sElement, $sEventType = "change")
Local $sFuncName = "_FFDispatchEvent"
$sEventType = StringLower($sEventType)
If StringLeft($sElement, 7) = "OBJECT|" Then $sElement = StringMid($sElement, 8)
Switch $sEventType
Case "change"
Case "select"
Case "focus"
Case "blur"
Case "resize"
Case Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(change) $sEventType: " & $sEventType))
Return 0
EndSwitch
If StringLeft($sElement, 1) = "." Then $sElement = "content.frames[" & __FFGetStatus() & "].document" & $sElement
Local $RetVal = _FFCmd("FFau3.fireEvent(" & $sElement & ", '" & $sEventType & "');")
If Not @error And $RetVal <> "_FFCmd_Err" Then
Return $RetVal
Else
SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "$sElement: " & $sElement))
Return 0
EndIf
Return 0
EndFunc ;==>_FFDispatchKeyEvent
; #FUNCTION# ===================================================================
; Name ..........: _FFLoadWait
; Description ...: Wait while the page is loading.
; Beschreibung ..: Wartet bis die Seite geladen ist.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFLoadWait([$iDelay = 0[, $iTimeOut = 20000]])
; Parameter(s): .: $iDelay - Optional: (Default = 0) : Delay before and after waiting in ms
; $iTimeOut - Optional: (Default = 20000) : Timeout while waiting in ms
; Return Value ..: Success - 1
; @EXTENDED - loading time in ms
; Failure - 0
; @ERROR -
; @EXTENDED - loading time in ms
; Author(s) .....: Thorsten Willert
; Date ..........: Tue Jul 07 10:06:11 CEST 2009
; Link ..........: https://developer.mozilla.org/en/nsIWebProgress
; Related .......: _FFDialogWait
; Example .......: Yes
; ==============================================================================
Func _FFLoadWait($iDelay = 0, $iTimeOut = 20000)
Local $sFuncName = "_FFLoadWait"
Local $iLoadingTime = 0
Local $bTrace = $_FF_COM_TRACE
$_FF_COM_TRACE = False
If Not $_FF_COM_TRACE Then ConsoleWrite("_FFLoadWait: ")
If $iDelay = Default Then $iDelay = 0
Sleep($iDelay + $_FF_CON_DELAY)
Local $TimeOutTimer = TimerInit()
While TimerDiff($TimeOutTimer) < $iTimeOut
If Not $_FF_COM_TRACE Then ConsoleWrite(".")
If Not _FFCmd("window.getBrowser().webProgress.isLoadingDocument") And _
_FFCmd("window.getBrowser().webProgress.busyFlags") = 0 Then
$iLoadingTime = Round(TimerDiff($TimeOutTimer))
ConsoleWrite(" loaded in " & $iLoadingTime & "ms" & @CRLF)
Sleep($_FF_CON_DELAY + 25)
$_FF_COM_TRACE = $bTrace
Return SetError(0, $iLoadingTime - $_FF_CON_DELAY - 25 - $iDelay, 1)
EndIf
Sleep(250)
WEnd
$_FF_COM_TRACE = $bTrace
ConsoleWrite(@CRLF & @CRLF)
Return SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, "Can not check site status."), $iLoadingTime,0)
EndFunc ;==>_FFLoadWait
; #FUNCTION# ===================================================================
; Name ..........: _FFGetObjectInfo
; Description ...: Returns a 2-dimensional array with every information of an object.
; Beschreibung ..: Liefert ein 2-dimensionales Array mit allen Informationen über ein Objekt.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFGetObjectInfo([$sObject = "window"])
; Parameter(s): .: $sObject - Optional: (Default = "window") :
; Return Value ..: Success - Array with object information
; Failure -
; @ERROR -
; Author(s) .....: Thorsten Willert
; Date ..........: Mon Mar 23 23:05:55 CET 2009 @962 /Internet Time/
; Link ..........:
; Related .......:
; Example .......: Yes
; ==============================================================================
Func _FFGetObjectInfo($sObject = "window")
Local $sFuncName = "_FFGetObjectInfo"
Local $aRet[1][2], $aTmp
If StringLeft($sObject, 1) = "." Then $sObject = "window.content.document" & $sObject
Local $aInfo = StringSplit(_FFCmd("repl.inspect(" & $sObject & ");"), @CRLF, 2)
If Not @error And IsArray($aInfo) And $aInfo <> "_FFCmd_Err" Then
ReDim $aRet[UBound($aInfo)][2]
For $i = 0 To UBound($aInfo) - 1
$aTmp = StringRegExp($aInfo[$i], "