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 stuffSuper 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 stuffSuper 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 Code *聽for 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 API *聽ErrorLog.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 TaskScheduler *聽IE 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 stuff *聽OnHungApp handler *聽Avoid "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...