Jump to content

FF.au3 (v0.6.0.1b-15) [End of life]


Danp2
 Share

Recommended Posts

Dear All,

Just to share an example of tracking Maersk containers.

In order to test, two lines should be added in the _FFTableWriteToArray function. Because the $sMode parameter does not allow a table to be selected by the class attribute.

Case "class"
            $sTable = "//table[@class='" & $vTable & "']"

And this is the example:

#include <FF V0.6.0.1b-15.au3>
#Include <Array.au3>

If _FFStart("https://my.maerskline.com/webuser/login?", Default, 2) Then
  _FFSetValue("myusername", "textfield-1017-inputEl", "id")
  Sleep(1000)
  _FFSetValue("mypassword", "textfield-1019-inputEl", "id")
EndIf

If _FFIsConnected() Then
   Sleep(1000)
   _FFClick("button-1023-btnIconEl", "id")
   Sleep(2000)

   _FFOpenURL("https://my.maerskline.com/shipmentbinder/b/958633021/show")
   _FFLoadWait()
   Sleep(5000)

   $aTable = _FFTableWriteToArray("route-details-table", "class", "text", 13, True)
   _ArrayDisplay($aTable)
EndIf

 

Link to comment
Share on other sites

Got this line that works on firefox cmd line to change youtube video volume:

video = document.getElementsByClassName('video-stream html5-main-video')[0]; video.volume = 1

tried: _FFCmd('video = document.getElementsByClassName("video-stream html5-main-video")[0]; video.volume = 0.5')

What am i missing here?

Thanks.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Thanks for the reply, but it still doesn't work, im on ver FF V0.6.0.1b-15.au3 btw, it just puts out:

__FFSend: try{window.content.top.document.getElementsByClassName('video-stream html5-main-video')[0].volume = .2}catch(e){'_FFCmd_Err';};
__FFRecv: _FFCmd_Err

Any suggestion?

Thanks

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • 4 weeks later...

hey guys, iam using "class" in _FFSetValue function and iam not getting any idea what value i should give in _FFFormSubmit(). 

please any body please provide an example code using "class" instead "id"  in _FFSetValue to fill the the online form. please

Link to comment
Share on other sites

  • 1 month later...

I've been thinking, wouldn't it be nice to include a function in the udf, that would install and activate MozRepl? I see some people have trouble with it.

Or maybe just a compiled script with the xpi file, separated from the udf..

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • 4 weeks later...

Here are my contribs.

1. Improved _FFClick so now it's able to click based on the CSS selector and on the text

Func _FFClick($sElement, $sMode = "elements", $iIndex = 0, $bLoadWait = True)
    Local Const $sFuncName = "_FFClick"

    If Not IsInt($iIndex) Then
        SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iIndex: " & $iIndex))
        Return 0
    EndIf

    If $sMode = Default Then $sMode = "elements"
    If $iIndex = Default Then $iIndex = 0

    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 "selector"
            $sElement = ".querySelectorAll('" & $sElement & "')[" & $iIndex & "]"
        Case "text"
            $sElement = ".evaluate(""//*[contains(text(), '" & $sElement & "')]"", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;"
        Case Else
            SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(elements|id|name|class|tag) $sMode: " & $sMode))
            Return 0
    EndSwitch

    If StringLeft($sElement, 1) = "." Then $sElement = "FFau3.WCD" & $sElement

    Local $RetVal = _FFCmd("FFau3.simulateEvent(" & $sElement & ",'MouseEvents','click');")
    If Not @error And $RetVal <> "_FFCmd_Err" And $RetVal = 1 Then
        Sleep(25)
        If $bLoadWait Then Return _FFLoadWait()
        __FFSetTopDocument()
        Return 1
    Else
        SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sElement: " & $sElement))
        Return 0
    EndIf

EndFunc

Examples:

_FFClick(".menu a.menuitem", "selector", 0)
_FFClick("Search", "text")

2. Added proxy changing support

Func _FFSetProxy($host, $port, $type)
    _FFUnSetProxy()
    _FFPrefSet("network.proxy.type",1)
    If $type = "http" Then
        _FFPrefSet("network.proxy.http", $host) ; http proxy
        _FFPrefSet("network.proxy.http_port", Int($port)) ; http proxy port
    ElseIf $type = "socks5" Then
        _FFPrefSet("network.proxy.socks" ,$host) ; socks
        _FFPrefSet("network.proxy.socks_port", Int($port)) ; socks port
        _FFPrefSet("network.proxy.socks_version", 5) ; socks version
    ElseIf $type = "socks4" Then
        _FFPrefSet("network.proxy.socks" ,$host) ; socks
        _FFPrefSet("network.proxy.socks_port", Int($port)) ; socks port
        _FFPrefSet("network.proxy.socks_version", 4) ; socks version
    EndIf
EndFunc

Func _FFUnSetProxy()
    _FFPrefReset("network.proxy.type")
    _FFPrefReset("network.proxy.http")
    _FFPrefReset("network.proxy.http_port")
    _FFPrefReset("network.proxy.socks")
    _FFPrefReset("network.proxy.socks_port")
    _FFPrefReset("network.proxy.socks_version")
EndFunc

Example:

_FFSetProxy("localhost", 8080, "socks5") ; socks5 proxy (i.e.: Tor and Putty/SSH)
_FFSetProxy("localhost", 8080, "socks4") ; socks4 proxy
_FFSetProxy("localhost", 8080, "http") ; http proxy
_FFUnSetProxy() ; reset to defaults

3. Fixed _FFStart() not finding Firefox executable in some machines

The UDF was not findind Firefox if the user installed a x86 version on a x64 OS. This function will take care on this:

Func __FFStartProcess($sURL = "about:blank", $bNewWin = False, $sProfile = "default", $bNoRemote = False, $bHide = False, $iPort = 4242, $iTimeOut = 30000)
    Local Const $sFuncName = "__FFStartProcess"

    Local $PID = -1
    Local $sNoRemote = "", $sNewWin
    Local $sProcName = $_FF_PROC_NAME

    If $sProfile = "default" Then
        $sProfile = ''
    Else
        $sProfile = ' -P "' & $sProfile & '"'
    EndIf
    If $bNoRemote Then $sNoRemote = "-no-remote"
    If $bNewWin Then $sNewWin = "-new-window"
    $sURL = '"' & $sURL & '"'
    If $iTimeOut < 2000 Then $iTimeOut = 2000


    ;Local $sHKLM = 'HKEY_LOCAL_MACHINE\SOFTWARE\'
       ;If @OSArch <> 'X86' Then $sHKLM &= 'Wow6432Node\'
       ;$sHKLM &= 'Mozilla\Mozilla Firefox'
       ;Local $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")

       #Region detect FF exe
       ; try to read x32 first
       Local $sHKLM = 'HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox'
       Local $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")

       If @error Then
           ; try to read amd64
            Local $sHKLM = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox'
            Local $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")
        EndIf
       #EndRegion

       If @error Then
       SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Error reading registry entry for FireFox." & @CRLF & _
        $sHKLM&"\*CurrentVersion*\Main\PathToExe" & @CRLF & _
        "Error from RegRead: " & @error))
        Return 0
       EndIf

    ; Updated per http://www.autoitscript.com/forum/topic/95595-ffau3-v0600b/page__st__380#entry958812
    ;Local $sCommand = StringFormat('"%s" %s %s %s "-repl %i %s"', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
    ;$sCommand = StringFormat('"%s" %s %s %s -repl %i %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
    ; UpdTED per http://www.kohberg.net/cms/pages/posts/autoit-ff.au3-oeffnet-immer-4242.com-beim-aufrufen-111.php
    Local $sCommand = StringFormat('"%s" %s %s %s -repl %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $sProfile)

    $PID = Run($sCommand)
    If $bHide Then BlockInput(1)

    Local $iTimeOutTimer = TimerInit()
    While 1
        Sleep(2000)
        If ProcessExists($sProcName) Then ExitLoop
        If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then
            SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, "Browser process not exists: " & $sProcName))
            BlockInput(0)
            Return 0
        EndIf
    WEnd

    If $bHide Then
        Local $WINTITLE_MATCH_MODE = AutoItSetOption("WinTitleMatchMode", 4)
        WinWaitActive("[CLASS:MozillaWindowClass]")
        Sleep(500)
        WinSetState("[CLASS:MozillaWindowClass]", "", @SW_MINIMIZE)
        BlockInput(0)
        AutoItSetOption("WinTitleMatchMode", $WINTITLE_MATCH_MODE)
    Else
        Sleep(1000)
    EndIf

    If $_FF_COM_TRACE Then _consolewrite('__FFStartProcess: "' & $sCommand & @CRLF)

    SetExtended($PID)
    Return 1
EndFunc   ;==>__FFStartProcess

Perhaps we should go to Github :shifty:

My stuff

Spoiler

My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS ·  storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt

 

Link to comment
Share on other sites

nice one! will this be added to the udf?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Perhaps we should go to Github? :D

Is it ok for the original author? Would he want to create the repo so we could PR?

My stuff

Spoiler

My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS ·  storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt

 

Link to comment
Share on other sites

  • 1 month later...

So far I had no need to seriously use this UDF.
However, this has changed.
I need to use FF UDF in one of my projects.
Defacto I have to migrate from IE to FF in this particular project.

For now, I have only one short question, is here available
any list , presenting equivalents for function names in FF with relation to IE

something like:
_IECreate >> _FF....
_IEAttach >> _FF....
_IEAction >> _FF....

.......

 

or:

_FF... >> _IE....

 

Regards
mLipok

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I've been testing the simple ...

$sVar = _FFAction("copy")

a few times to copy a simple active text selection...

Often it seems to be copying "other stuff" on the back of it?

(1) Am I understanding this function wrongly? Not interesting as a more reliable Ctrl+c substitute?

(2) Why the Delimiter parameter? Is that in case you select multiple form fields, and it will then separate the contents with the delimiter?

(3) Does anyone know if you can get just the 'View Selection Source' (Firefox context menu) data from a selected piece of text into a variable? (I know you can get the *full* source)

Edited by Guy_
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...