Jump to content

wd_capabilities.au3 - support topic - early BETA version - Work In Progress


Recommended Posts

  • Replies 91
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Just my 2 cents worth. Somewhere in this thread you say that your WD Capabilities UDF should become part of the WebDriver UDF. In this case, I would strongly recommend using the WebDriver UDF n

Just for fun:   Saludos

New version:   #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Exit Func _Example() If $IDYES = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQ

Posted Images

2 minutes ago, Danp2 said:

You sure are a fan of underscores. 😜

 

On 6/28/2014 at 5:33 AM, jaberwacky said:

mLipok, the master of finding bugs.

hahahah.....

 

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
4 minutes ago, Danp2 said:

This should be a comma instead of a colon. Otherwise, I think the formatting is good.

searching.....

btw:
https://stackoverflow.com/questions/69048644/webdriver-chrome-list-of-excludeswitches

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites

as for now I'm on this stage:

Func _Example_Danp2()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
;~  __WD_Capabilities__Startup()
;~  __WD_Capabilities__Capability('browserName', 'firefox')
;~  __WD_Capabilities__Capability('acceptInsecureCerts', True)
;~  __WD_Capabilities__Argument('-profile')
;~  __WD_Capabilities__Argument($s_My_Profile_Dir)
;~  Local $s_Desired_Capabilities = __WD_Capabilities__Build('firefox')

    _WD_Capabilities($_WD_CAPS__STARTUP)
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'browserName', 'firefox')
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'acceptInsecureCerts', True)
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, '-profile')
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, $s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities($_WD_CAPS__BUILD, 'firefox')

    ConsoleWrite($s_Desired_Capabilities & @CRLF)
    ConsoleWrite('=============' & @CRLF)
EndFunc   ;==>_Example_Danp2

 

How it looks ?

Maybe enums should also be trimmed....

Global Enum
        $_WD_CAPS_STARTUP = 11001, _
        $_WD_CAPS_CAPABILITY, _
        $_WD_CAPS_EXCLUSION, _
        $_WD_CAPS_OPTION, _
        $_WD_CAPS_ARGUMENT, _
        $_WD_CAPS_PREFERENCE, _
        $_WD_CAPS_LOG, _
        $_WD_CAPS_ENV, _
        $_WD_CAPS_BUILD, _
        $_WD_CAPS_COUNTER

 

or....
 

Global Enum
        $_WD_CAPS_Startup = 11001, _
        $_WD_CAPS_Capability, _
        $_WD_CAPS_Exclusion, _
        $_WD_CAPS_Option, _
        $_WD_CAPS_Argument, _
        $_WD_CAPS_Preference, _
        $_WD_CAPS_Log, _
        $_WD_CAPS_Env, _
        $_WD_CAPS_Build, _
        $_WD_CAPS_COUNTER

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites

Personally I prefer separate function for each action

Reason 1: smaller code

Func _Example_1()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability('browserName', 'firefox')
    _WD_Capabilities_Capability('acceptInsecureCerts', True)
    _WD_Capabilities_Argument('-profile')
    _WD_Capabilities_Argument($s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities_Build('firefox')
EndFunc   ;==>_Example_Danp2

Func _Example_2()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
    _WD_Capabilities($_WD_CAPS__STARTUP)
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'browserName', 'firefox')
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'acceptInsecureCerts', True)
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, '-profile')
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, $s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities($_WD_CAPS__BUILD, 'firefox')

EndFunc   ;==>_Example_Danp2


Reason 2: function list

image.png.8332f4cf04b1521f29c91bf72240406a.png

Reason 3: Caltips

image.png.c119b04f152b5a4eb56e7a6a3eecfcc8.png

using $_WD_CAPS_* there is lack of direct information what to put into parameters

image.png.510929d73835c7e1b348ca7693955dd5.png

 

Reason 4: easier to understand UDF Function Header (aka documentation) 
of course when it will be crated ;)

 

btw.
Of course, both forms can coexist simultaneously.

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
Quote

I hope this is possible with some kind of magical AutoIt coding technique.

Just for fun:

Spoiler
Global $__goScript = 0



_Test()

Func _Test()
    Local $oCapabilities = _WD_Capabilities()
    $oCapabilities.Argument("-profile")
    $oCapabilities.Argument(@ScriptDir & "\Test-Profile")
;~ $oCapabilities.Argument("--headless")
    $oCapabilities.Argument("start-maximized")

    $oCapabilities.Add("browserName", "chrome")
    $oCapabilities.Option("w3c", True)
    $oCapabilities.Option("excludeSwitches", '["enable-automation", "load-extension"]')
;~ $oCapabilities.Log("trace")
    $oCapabilities.Preference('javascript.options.showInConsole', False)
    $oCapabilities.Preference("download.default_directory", @ScriptDir)

    ConsoleWrite($oCapabilities.Json() & @CRLF) ;this show broswerOptions instead  goog:chromeOptions or required for each broswer
    ConsoleWrite($oCapabilities.Chrome() & @CRLF)

EndFunc   ;==>_Test

Func _WD_Capabilities()
    Local $ObjErr = ObjEvent("AutoIt.Error", "_ErrorHandler")
    $__goScript = ObjCreate("ScriptControl")
    $__goScript.Language = "JScript"
    $__goScript.AddCode(_Json2_MinJS())
    $__goScript.AddCode(_JS())
    Return $__goScript.Eval("new MyObject")
EndFunc   ;==>_WD_Capabilities

Func _ErrorHandler()

EndFunc   ;==>_ErrorHandler


Func _JS()
;~  Return FileRead("file.js")
    Local $sJs = 'function MyObject() {' & @CRLF & _
            '    this.value = {' & @CRLF & _
            '        "capabilities": {' & @CRLF & _
            '            "firstMatch": [{}],' & @CRLF & _
            '            "alwaysMatch": {' & @CRLF & _
            '                "broswerOptions": {' & @CRLF & _
            '                    "args": []' & @CRLF & _
            '                }' & @CRLF & _
            '            }' & @CRLF & _
            '        }' & @CRLF & _
            '    };' & @CRLF & _
            '    this.Argument = function(value) {' & @CRLF & _
            '        this.value.capabilities.alwaysMatch.broswerOptions.args.push(value);' & @CRLF & _
            '    }' & @CRLF & _
            '   this.Option = function(key, value) {' & @CRLF & _
            '       if (typeof value === "string" && value.indexOf("[") > -1) {' & @CRLF & _
            '           value = eval(value);' & @CRLF & _
            '       }' & @CRLF & _
            '        this.value.capabilities.alwaysMatch.broswerOptions[key]=value;' & @CRLF & _
            '    }' & @CRLF & _
            '   this.Log = function(value) {' & @CRLF & _
            '       var level={};' & @CRLF & _
            '       level["level"]=value;' & @CRLF & _
            '        this.value.capabilities.alwaysMatch.broswerOptions.log = level;' & @CRLF & _
            '    }' & @CRLF & _
            '    this.Add = function(key, value) {' & @CRLF & _
            '        if (value.indexOf("[") > -1) {' & @CRLF & _
            '            value = eval(value);' & @CRLF & _
            '        };' & @CRLF & _
            '        this.value.capabilities.alwaysMatch[key] = value;' & @CRLF & _
            '    }' & @CRLF & _
            '    this.Preference = function(key, value) {' & @CRLF & _
            '        var pref = this.value.capabilities.alwaysMatch.broswerOptions.prefs;' & @CRLF & _
            '   if (pref == undefined) {' & @CRLF & _
            '            pref = {}' & @CRLF & _
            '        };' & @CRLF & _
            '        pref[key] = value;' & @CRLF & _
            '        this.value.capabilities.alwaysMatch.broswerOptions.prefs = pref;' & @CRLF & _
            '    }' & @CRLF & _
            '    this.Json = function() {' & @CRLF & _
            '        return JSON.stringify(this.value); //this return without valid broswerOptions key name' & @CRLF & _
            '    }' & @CRLF & _
            '   this.Chrome = function() {' & @CRLF & _
            '        return JSON.stringify(this.value).replace("broswerOptions","goog:chromeOptions"); ' & @CRLF & _
            '    }' & @CRLF & _
            '   this.Firefox = function() {' & @CRLF & _
            '        return JSON.stringify(this.value).replace("broswerOptions","moz:firefoxOptions");  ' & @CRLF & _
            '    }' & @CRLF & _
            '   this.Edge = function() {' & @CRLF & _
            '        return JSON.stringify(this.value).replace("broswerOptions","edge:edgeOptions"); ' & @CRLF & _
            '    }' & @CRLF & _
            '};'
    Return $sJs
EndFunc   ;==>_JS


;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-01-20
;~ https://github.com/douglascrockford/JSON-js/blob/master/json2.js
Func _Json2_MinJS($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $_Json2_MinJS
    $_Json2_MinJS &= 'Ly8gIGpzb24yLmpzCi8vICAyMDE3LTA2LTEyCi8vICBQdWJsaWMgRG9tYWluLgovLyAgTk8gV0FSUkFOVFkgRVhQUkVTU0VEIE9SIElNUExJRUQuIFVTRSBBVCBZT1VSIE9XTiBSSVNLLgoKLy8gIFVTRSBZT1VSIE9XTiBDT1BZLiBJVCBJUyBFWFRSRU1FTFkgVU5XSVNFIFRPIExPQUQgQ09ERSBGUk9NIFNFUlZFUlMgWU9VIERPCi8vICBOT1QgQ09OVFJPTC4KCi8vICBUaGlzIGZpbGUgY3JlYXRlcyBhIGdsb2JhbCBKU09OIG9iamVjdCBjb250YWluaW5nIHR3byBtZXRob2RzOiBzdHJpbmdpZnkKLy8gIGFuZCBwYXJzZS4gVGhpcyBmaWxlIHByb3ZpZGVzIHRoZSBFUzUgSlNPTiBjYXBhYmlsaXR5IHRvIEVTMyBzeXN0ZW1zLgovLyAgSWYgYSBwcm9qZWN0IG1pZ2h0IHJ1biBvbiBJRTggb3IgZWFybGllciwgdGhlbiB0aGlzIGZpbGUgc2hvdWxkIGJlIGluY2x1ZGVkLgovLyAgVGhpcyBmaWxlIGRvZXMgbm90aGluZyBvbiBFUzUgc3lzdGVtcy4KCi8vICAgICAgSlNPTi5zdHJpbmdpZnkodmFsdWUsIHJlcGxhY2VyLCBzcGFjZSkKLy8gICAgICAgICAgdmFsdWUgICAgICAgYW55IEphdmFTY3JpcHQgdmFsdWUsIHVzdWFsbHkgYW4gb2JqZWN0IG9yIGFycmF5LgovLyAgICAgICAgICByZXBsYWNlciAgICBhbiBvcHRpb25hbCBwYXJhbWV0ZXIgdGhhdCBkZXRlcm1pbmVzIGhvdyBvYmplY3QKLy8gICAgICAgICAgICAgICAgICAgICAgdmFsdWVzIGFyZSBzdHJpbmdpZmllZCBmb3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Mgbm90IHNlcmlhbGl6ZTogaXQgcmV0dXJucyB0aGUKLy8gICAgICAgICAgdmFsdWUgcmVwcmVzZW50ZWQgYnkgdGhlIG5hbWUvdmFsdWUgcGFpciB0aGF0IHNob3VsZCBiZSBzZXJpYWxpemVkLAovLyAgICAgICAgICBvciB1bmRlZmluZWQgaWYgbm90aGluZyBzaG91bGQgYmUgc2VyaWFsaXplZC4gVGhlIHRvSlNPTiBtZXRob2QKLy8gICAgICAgICAgd2lsbCBiZSBwYXNzZWQgdGhlIGtleSBhc3NvY2lhdGVkIHdpdGggdGhlIHZhbHVlLCBhbmQgdGhpcyB3aWxsIGJlCi8vICAgICAgICAgIGJvdW5kIHRvIHRoZSB2YWx1ZS4KCi8vICAgICAgICAgIEZvciBleGFtcGxlLCB0aGlzIHdvdWxkIHNlcmlhbGl6ZSBEYXRlcyBhcyBJU08gc3RyaW5ncy4KCi8vICAgICAgICAgICAgICBEYXRlLnByb3RvdHlwZS50b0pTT04gPSBmdW5jdGlvbiAoa2V5KSB7Ci8vICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZihuKSB7Ci8vICAgICAgICAgICAgICAgICAgICAgIC8vIEZvcm1hdCBpbnRlZ2VycyB0byBoYXZlIGF0IGxlYXN0IHR3byBkaWdpdHMuCi8vICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAobiA8IDEwKQovLyAgICAgICAgICAgICAgICAgICAgICAgICAgPyAiMCIgKyBuCi8vICAgICAgICAgICAgICAgICAgICAgICAgICA6IG47Ci8vICAgICAgICAgICAgICAgICAgfQovLyAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldFVUQ0Z1bGxZZWFyKCkgICArICItIiArCi8vICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMuZ2V0VVRDTW9udGgoKSArIDEpICsgIi0iICsKLy8gICAgICAgICAgICAgICAgICAgICAgIGYodGhpcy5nZXRVVENEYXRlKCkpICAgICAgKyAiVCIgKwovLyAgICAgICAgICAgICAgICAgIC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Qgb2YgdGhlIG9yaWdpbmFsIHZhbHVlLgovLyAgICAgICAgICBJZiBpdCByZXR1cm5zIHdoYXQgaXQgcmVjZWl2ZWQsIHRoZW4gdGhlIHN0cnVjdHVyZSBpcyBub3QgbW9kaWZpZWQuCi8vICAgICAgICAgIElmIGl0IHJldHVybnMgdW5kZWZpbmVkIHRoZW4gdGhlIG1lbWJlciBpcyBkZWxldGVkLgoKLy8gICAgICAgICAgRXhhbXBsZToKCi8vICAgICAgICAgIC8vIFBhcnNlIHRoZSB0ZXh0LiBWYWx1ZXMgdGhhdCBsb29rIGxpa2UgSVNPIGRhdGUgc3RyaW5ncyB3aWxsCi8vICAgICAgICAgIC8vIGJlIGNvbnZlcnRlZCB0byBEYXRlIG9iamVjdHMuCgovLyAgICAgICAgICBteURhdGEgPSBKU09OLnBhcnNlKHRleHQsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7Ci8vICAgICAgICAgICAgICB2YXIgYTsKLy8gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICJzdHJpbmciKSB7Ci8vICAgICAgICAgICAgICAgICAgYSA9Ci8vICAgL14oXGR7NH0pLShcZHsyfSktKFxkezJ9KVQoXGR7Mn0pOihcZHsyfSk6KFxkezJ9KD86XC5cZCopPylaJC8uZXhlYyh2YWx1ZSk7Ci8vICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKLy8gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKERhdGUuVVRDKAovLyAgICAgICAgICAgICAgICAgICAgICAgICArYVsxXSwgK2FbMl0gLSAxLCArYVszXSwgK2FbNF0sICthWzVdLCArYVs2XQovLyAgICAgICAgICAgICAgICAgICAgICApKTsKLy8gICAgICAgICAgICAgICAgICB9Ci8vICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwovLyAgICAgICAgICAgICAgfQovLyAgICAgICAgICB9KTsKCi8vICAgICAgICAgIG15RGF0YSA9IEpTT04ucGFyc2UoCi8vICAgICAgICAgICAgICAiW1wiRGF0ZSgwOS8wOS8yMDAxKVwiXSIsCi8vICAgICAgICAgICAgICBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkgewovLyAgICAgICAgICAgICAgICAgIHZhciBkOwovLyAgICAgICAgICAgICAgICAgIGlmICgKLy8gICAgICAgICAgICAgICAgICAgICAgdHlwZW9mIHZhbHVlID09PSAic3RyaW5nIgovLyAgICAgICAgICAgICAgICAgICAgICAmJiB2YWx1ZS5zbGljZSgwLCA1KSA9PT0gIkRhdGUoIgovLyAgICAgICAgICAgICAgICAgICAgICAmJiB2YWx1ZS5zbGljZSgtMSkg'
    $_Json2_MinJS &= 'PT09ICIpIgovLyAgICAgICAgICAgICAgICAgICkgewovLyAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IERhdGUodmFsdWUuc2xpY2UoNSwgLTEpKTsKLy8gICAgICAgICAgICAgICAgICAgICAgaWYgKGQpIHsKLy8gICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwovLyAgICAgICAgICAgICAgICAgICAgICB9Ci8vICAgICAgICAgICAgICAgICAgfQovLyAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLy8gICAgICAgICAgICAgIH0KLy8gICAgICAgICAgKTsKCi8vICBUaGlzIGlzIGEgcmVmZXJlbmNlIGltcGxlbWVudGF0aW9uLiBZb3UgYXJlIGZyZWUgdG8gY29weSwgbW9kaWZ5LCBvcgovLyAgcmVkaXN0cmlidXRlLgoKLypqc2xpbnQKICAgIGV2YWwsIGZvciwgdGhpcwoqLwoKLypwcm9wZXJ0eQogICAgSlNPTiwgYXBwbHksIGNhbGwsIGNoYXJDb2RlQXQsIGdldFVUQ0RhdGUsIGdldFVUQ0Z1bGxZZWFyLCBnZXRVVENIb3VycywKICAgIGdldFVUQ01pbnV0ZXMsIGdldFVUQ01vbnRoLCBnZXRVVENTZWNvbmRzLCBoYXNPd25Qcm9wZXJ0eSwgam9pbiwKICAgIGxhc3RJbmRle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YwLVx1MjA2Zlx1ZmVmZlx1ZmZmMC1cdWZmZmZdL2c7CgogICAgZnVuY3Rpb24gZihuKSB7CiAgICAgICAgLy8gRm9ybWF0IGludGVnZXJzIHRvIGhhdmUgYXQgbGVhc3QgdHdvIGRpZ2l0cy4KICAgICAgICByZXR1cm4gKG4gPCAxMCkKICAg'
    $_Json2_MinJS &= 'ICAgICAgICAgPyAiMCIgKyBuCiAgICAgICAgICAgIDogbjsKICAgIH0KCiAgICBmdW5jdGlvbiB0aGlzX3ZhbHVlKCkgewogICAgICAgIHJldHVybiB0aGlzLnZhbHVlT2YoKTsKICAgIH0KCiAgICBpZiAodHlwZW9mIERhdGUucHJvdG90eXBlLnRvSlNPTiAhPT0gImZ1bmN0aW9uIikgewoKICAgICAgICBEYXRlLnByb3RvdHlwZS50b0pTT04gPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICByZXR1cm4gaXNGaW5pdGUodGhpcy52YWx1ZU9mKCkpCiAgICAgICAgICAgICAgICA/ICgKICAgICAgICAgICAgICAgICAgICB0aGlzLmdldFVUQ0Z1bGxZZWFyKCkKICAgICAgICAgICAgICAgICAgICArICItIgogICAgICAgICAgICAgICAgICAgICsgZih0aGlzLmdldFVUQ01vbnRoKCkgKyAxKQogICAgICAgICAgICAgICAgICAgICsgIi0iCiAgICAgICAgICAgICAgICAgICAgKyBmKHRoaXMuZ2V0VVRDRGF0ZSgpKQogICAgICAgICAgICAgICAgICAgICsgIlQiCiAgICAgICAgICAgICAgICAgICAgKyBmKHRoaXMuZ2V0VVRDSG91cnMoKSkKICAgICAgICAgICAgICAgICAgICArICI6IgogICAgICAgICAgICAgICAgICAgICsgZih0aGlzLmdldFVUQ01pbnV0ZXMoKSkKICAgICAgICAgICAgICAgICAgICArICI6IgogICAgICAgICAgICAgICAgICAgICsgZih0aGlzLmdldFVUQ1NlY29uZHMoKSkKICAgICAgICAgICAgICAgICAgICArICJaIgogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgOiBudWxsOwogICAgICAgIH07CgogICAgICAgIEJvb2xlYW4ucHJvdG90eXBlLnRvSlNPTiA9IHRoaXNfdmFsdWU7CiAgICAgICAgTnVtYmVyLnByb3RvdHlwZS50b0pTT04gPSB0aGlzX3ZhbHVlOwogICAgICAgIFN0cmluZy5wcm90b3R5cGUudG9KU09OID0gdGhpc192YWx1ZTsKICAgIH0KCiAgICB2YXIgZ2FwOwogICAgdmFyIGluZGVudDsKICAgIHZhciBtZXRhOwogICAgdmFyIHJlcDsKCgogICAgZnVuY3Rpb24gcXVvdGUoc3RyaW5nKSB7CgovLyBJZiB0aGUgc3RyaW5nIGNvbnRhaW5zIG5vIGNvbnRyb2wgY2hhcmFjdGVycywgbm8gcXVvdGUgY2hhcmFjdGVycywgYW5kIG5vCi8vIGJhY2tzbGFzaCBjaGFyYWN0ZXJzLCB0aGVuIHdlIGNhbiBzYWZlbHkgc2xhcCBzb21lIHF1b3RlcyBhcm91bmQgaXQuCi8vIE90aGVyd2lzZSB3ZSBtdXN0IGFsc28gcmVwbGFjZSB0aGUgb2ZmZW5kaW5nIGNoYXJhY3RlcnMgd2l0aCBzYWZlIGVzY2FwZQovLyBzZXF1ZW5jZXMuCgogICAgICAgIHJ4X2VzY2FwYWJsZS5sYXN0SW5kZXggPSAwOwogICAgICAgIHJldHVybiByeF9lc2NhcGFibGUudGVzdChzdHJpbmcpCiAgICAgICAgICAgID8gIlwiIiArIHN0cmluZy5yZXBsYWNlKHJ4X2VzY2FwYWJsZSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gbWV0YVthXTsKICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgYyA9PT0gInN0cmluZyIKICAgICAgICAgICAgICAgICAgICA/IGMKICAgICAgICAgICAgICAgICAgICA6ICJcXHUi'
    $_Json2_MinJS &= 'ICsgKCIwMDAwIiArIGEuY2hhckNvZGVBdCgwKS50b1N0cmluZygxNikpLnNsaWNlKC00KTsKICAgICAgICAgICAgfSkgKyAiXCIiCiAgICAgICAgICAgIDogIlwiIiArIHN0cmluZyArICJcIiI7CiAgICB9CgoKICAgIGZ1bmN0aW9uIHN0cihrZXksIGhvbGRlcikgewoKLy8gUHJvZHVjZSBhIHN0cmluZyBmcm9tIGhvbGRlcltrZXldLgoKICAgICAgICB2YXIgaTsgICAgICAgICAgLy8gVGhlIGxvb3AgY291bnRlci4KICAgICAgICB2YXIgazsgICAgICAgICAgLy8gVGhlIG1lbWJlciBrZXkuCiAgICAgICAgdmFyIHY7ICAgICAgICAgIC8vIFRoZSBtZW1iZXIgdmFsdWUuCiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgbWluZCA9IGdhcDsKICAgICAgICB2YXIgcGFydGlhbDsKICAgICAgICB2YXIgdmFsdWUgPSBob2xkZXJba2V5XTsKCi8vIElmIHRoZSB2YWx1ZSBoYXMgYSB0b0pTT04gbWV0aG9kLCBjYWxsIGl0IHRvIG9idGFpbiBhIHJlcGxhY2VtZW50IHZhbHVlLgoKICAgICAgICBpZiAoCiAgICAgICAgICAgIHZhbHVlCiAgICAgICAgICAgICYmIHR5cGVvZiB2YWx1ZSA9PT0gIm9iamVjdCIKICAgICAgICAgICAgJiYgdHlwZW9mIHZhbHVlLnRvSlNPTiA9PT0gImZ1bmN0aW9uIgogICAgICAgICkgewogICAgICAgICAgICB2YWx1ZSA9IHZhbHVlLnRvSlNPTihrZXkpOwogICAgICAgIH0KCi8vIElmIHdlIHdlcmUgY2FsbGVkIHdpdGggYSByZXBsYWNlciBmdW5jdGlvbiwgdGhlbiBjYWxsIHRoZSByZXBsYWNlciB0bwovLyBvYnRhaW4gYSByZXBsYWNlbWVudCB2YWx1ZS4KCiAgICAgICAgaWYgKHR5cGVvZiByZXAgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgdmFsdWUgPSByZXAuY2FsbChob2xkZXIsIGtleSwgdmFsdWUpOwogICAgICAgIH0KCi8vIFdoYXQgaGFwcGVucyBuZXh0I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sKICAgICAgICAgICAgICAgIHJldHVybiAibnVsbCI7CiAgICAgICAgICAgIH0KCi8vIE1ha2UgYW4gYXJyYXkgdG8gaG9sZCB0aGUgcGFydGlhbCByZXN1bHRzIG9mIHN0cmluZ2lmeWluZyB0aGlzIG9iamVjdCB2YWx1ZS4KCiAgICAgICAgICAgIGdhcCArPSBpbmRlbnQ7CiAgICAgICAgICAgIHBhcnRpYWwgPSBbXTsKCi8vIElzIHRoZSB2YWx1ZSBhbiBhcnJheT8KCiAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmFwcGx5KHZhbHVlKSA9PT0gIltvYmplY3QgQXJyYXldIikgewoKLy8gVGhlIHZhbHVlIGlzIGFuIGFycmF5LiBTdHJpbmdpZnkgZXZlcnkgZWxlbWVudC4gVXNlIG51bGwgYXMgYSBwbGFjZWhvbGRlcgovLyBmb3Igbm9uLUpTT04gdmFsdWVzLgoKICAgICAgICAgICAgICAgIGxlbmd0aCA9IHZhbHVlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7IGkgKz0gMSkgewogICAgICAgICAgICAgICAgICAgIHBhcnRpYWxbaV0gPSBzdHIoaSwgdmFsdWUpIHx8ICJudWxsIjsKICAgICAgICAgICAgICAgIH0KCi8vIEpvaW4gYWxsIG9mIHRoZSBlbGVtZW50cyB0b2dldGhlciwgc2VwYXJhdGVkIHdpdGggY29tbWFzLCBhbmQgd3JhcCB0aGVtIGluCi8vIGJyYWNrZXRzLgoKICAgICAgICAgICAgICAgIHYgPSBwYXJ0aWFsLmxlbmd0aCA9PT0gMAogICAgICAgICAgICAgICAgICAgID8gIltdIgogICAgICAgICAgICAgICAgICAgIDogZ2FwCiAgICAgICAgICAgICAgICAgICAgICAgID8gKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIltcbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgZ2FwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHBhcnRpYWwuam9pbigiLFxuIiArIGdhcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlxuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtaW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICArICJdIgogICAgICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgICAgIDogIlsiICsgcGFydGlhbC5qb2luKCIsIikgKyAiXSI7CiAgICAgICAgICAgICAgICBnYXAgPSBtaW5kOwogICAgICAgICAgICAgICAgcmV0dXJuIHY7CiAgICAgICAgICAgIH0KCi8vIElmIHRoZSByZXBsYWNlciBpcyBhbiBhcnJheSwgdXNlIGl0IHRvIHNlbGVjdCB0aGUgbWVtYmVycyB0byBiZSBzdHJpbmdpZmllZC4KCiAgICAgICAgICAgIGlmIChyZXAgJiYgdHlwZW9mIHJlcCA9'
    $_Json2_MinJS &= 'PT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgICAgIGxlbmd0aCA9IHJlcC5sZW5ndGg7CiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHJlcFtpXSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IHJlcFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgdiA9IHN0cihrLCB2YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJ0aWFsLnB1c2gocXVvdGUoaykgKyAoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdhcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyAiOiAiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIjoiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICApICsgdik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CgovLyBPdGhlcndpc2UsIGl0ZXJhdGUgdGhyb3VnaCBhbGwgb2YgdGhlIGtleXMgaW4gdGhlIG9iamVjdC4KCiAgICAgICAgICAgICAgICBmb3IgKGsgaW4gdmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gc3RyKGssIHZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpYWwucHVzaChxdW90ZShrKSArICgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2FwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/ICI6ICIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAiOiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICkgKyB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKLy8gSm9pbiBhbGwgb2YgdGhlIG1lbWJlciB0ZXh0cyB0b2dldGhlciwgc2VwYXJhdGVkIHdpdGggY29tbWFzLAovLyBhbmQgd3JhcCB0aGVtIGluIGJyYWNlcy4KCiAgICAgICAgICAgIHYgPSBwYXJ0aWFsLmxlbmd0aCA9PT0gMAogICAgICAgICAgICAgICAgPyAie30iCiAgICAgICAgICAgICAgICA6IGdhcAogICAgICAgICAgICAgICAgICAgID8gIntcbiIgKyBnYXAgKyBwYXJ0aWFsLmpvaW4oIixcbiIgKyBnYXApICsgIlxuIiArIG1pbmQgKyAifSIKICAgICAgICAgICAgICAgICAgICA6ICJ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GUgc3BhY2UgcGFyYW1ldGVyIGNhbgovLyBwcm9kdWNlIHRleHQgdGhhdCBpcyBtb3JlIGVhc2lseSByZWFkYWJsZS4KCiAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICBnYXAgPSAiIjsKICAgICAgICAgICAgaW5kZW50ID0gIiI7CgovLyBJZiB0aGUgc3BhY2UgcGFyYW1ldGVyIGlzIGEgbnVtYmVyLCBtYWtlIGFuIGluZGVudCBzdHJpbmcgY29udGFpbmluZyB0aGF0Ci8vIG1hbnkgc3BhY2VzLgoKICAgICAgICAgICAgaWYgKHR5cGVvZiBzcGFjZSA9PT0gIm51bWJlciIpIHsKICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzcGFjZTsgaSArPSAxKSB7CiAgICAgICAgICAgICAgICAgICAgaW5kZW50ICs9ICIgIjsKICAgICAgICAgICAgICAgIH0KCi8vIElmIHRoZSBzcGFjZSBwYXJhbWV0ZXIgaXMgYSBzdHJpbmcsIGl0IHdpbGwgYmUgdXNlZCBhcyB0aGUgaW5kZW50IHN0cmluZy4KCiAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHNwYWNlID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgaW5kZW50ID0gc3BhY2U7CiAgICAgICAgICAgIH0KCi8vIElmIHRoZXJlIGlzIGEgcmVwbGFjZXIsIGl0IG11c3QgYmUgYSBmdW5jdGlvbiBvciBhbiBhcnJheS4KLy8gT3RoZXJ3aXNlLCB0aHJvdyBhbiBlcnJvci4KCiAgICAgICAgICAgIHJlcCA9IHJlcGxhY2VyOwogICAgICAgICAgICBpZiAocmVwbGFjZXIgJiYgdHlwZW9mIHJlcGxhY2VyICE9PSAiZnVuY3Rpb24iICYmICgKICAgICAgICAgICAgICAgIHR5cGVvZiByZXBsYWNlciAhPT0gIm9iamVjdCIKICAgICAgICAgICAgICAg'
    $_Json2_MinJS &= 'IHx8IHR5cGVvZiByZXBsYWNlci5sZW5ndGggIT09IC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AgICAgICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAib2JqZWN0IikgewogICAgICAgICAgICAgICAgICAgIGZvciAoayBpbiB2YWx1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdiA9IHdhbGsodmFsdWUsIGspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYgIT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHZhbHVlW2tdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHJldml2ZXIuY2FsbChob2xkZXIsIGtleSwgdmFsdWUpOwogICAgICAgICAgICB9CgoKLy8gUGFyc2luZyBoYXBwZW5zIGluIGZvdXIgc3RhZ2VzLiBJbiB0aGUgZmlyc3Qgc3RhZ2UsIHdlIHJlcGxhY2Ug'
    $_Json2_MinJS &= 'Y2VydGFpbgovLyBVbmljb2RlIGNoYXJhY3RlcnMgd2l0aCBlc2NhcGUgc2VxdWVuY2VzLiBKYXZhU2NyaXB0IGhhbmRsZXMgbWFueSBjaGFyYWN0ZXJzCi8vIGluY29ycmVjdGx5LCBlaXRoZXIgc2lsZW50bHkgZGVsZXRpbmcgdGhlbSwgb3IgdHJlYXRpbmcgdGhlbSBhcyBsaW5lIGVuZGluZ3MuCgogICAgICAgICAgICB0ZXh0ID0gU3RyaW5nKHRleHQpOwogICAgICAgICAgICByeF9kYW5nZX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y8gaW4gcGFyZW5zIHRvIGVsaW1pbmF0ZSB0aGUgYW1iaWd1aXR5LgoKICAgICAgICAgICAgICAgIGogPSBldmFsKCIoIiArIHRleHQgKyAiKSIpOwoKLy8gSW4gdGhlIG9wdGlvbmFsIGZvdXJ0aCBzdGFnZSwgd2UgcmVjdXJzaXZlbHkgd2FsayB0aGUgbmV3IHN0cnVjdHVyZSwgcGFzc2luZwovLyBlYWNoIG5hbWUvdmFsdWUgcGFpciB0byBhIHJldml2ZXIgZnVuY3Rpb24gZm9yIHBvc3NpYmxlIHRyYW5zZm9ybWF0aW9uLgoKICAgICAgICAgICAgICAgIHJldHVybiAodHlwZW9mIHJldml2ZXIgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgICAgICAgICAgPyB3YWxrKHsiIjogan0sICIiKQogICAgICAgICAgICAgICAgICAgIDogajsKICAgICAgICAgICAgfQoKLy8gSWYgdGhlIHRleHQgaXMgbm90IEpTT04gcGFyc2VhYmxlLCB0aGVuIGEgU3ludGF4RXJyb3IgaXMgdGhyb3duLgoKICAgICAgICAgICAgdGhyb3cgbmV3IFN5bnRheEVycm9yKCJKU09OLnBhcnNlIik7CiAgICAgICAgfTsKICAgIH0KfSgpKTsK'
    Local Const $bString = Binary(_WinAPI_Base64Decode($_Json2_MinJS))
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\json2.js", 18)
        If @error Then Return SetError(1, 0, 0)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return BinaryToString($bString)
EndFunc   ;==>__Json2_MinJS

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

 

 

Saludos

Link to post
Share on other sites
On 9/4/2021 at 3:51 AM, Danyfirex said:

Just for fun:

This is that kind of AutoIt magic which I was talking about.

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
On 9/3/2021 at 8:19 PM, mLipok said:

Personally I prefer separate function for each action

I see that @Danyfirex gave me a react_thanks.png so ask only @Danp2:  What you think about this concept ?

 

On 9/3/2021 at 8:19 PM, mLipok said:

btw.
Of course, both forms can coexist simultaneously.

@Danp2 and @Danyfirex : What do you both think of this concept?

 

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
2 minutes ago, mLipok said:

 

On 9/3/2021 at 8:19 PM, mLipok said:

btw.
Of course, both forms can coexist simultaneously.

@Danp2 and @Danyfirex : What do you both think of this concept?

btw.
I just use kind a wrapper for this so this is already workable

Global Enum _
        $_WD_CAPS__STARTUP = 11001, _
        $_WD_CAPS__ADD_CAPABILITY, _
        $_WD_CAPS__ADD_EXCLUSION, _
        $_WD_CAPS__ADD_OPTION, _
        $_WD_CAPS__ADD_ARGUMENT, _
        $_WD_CAPS__ADD_PREFERENCE, _
        $_WD_CAPS__ADD_LOG, _
        $_WD_CAPS__ADD_ENV, _
        $_WD_CAPS__BUILD, _
        $_WD_CAPS__COUNTER

Func _WD_Capabilities($_CAP_ACTION, $PARAM1 = '', $PARAM2 = '')
    Switch $_CAP_ACTION
        Case $_WD_CAPS__STARTUP
            __WD_Capabilities__Startup()
        Case $_WD_CAPS__ADD_CAPABILITY
            __WD_Capabilities__Capability($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_EXCLUSION
            __WD_Capabilities__ExcludeSwitches($PARAM1)
        Case $_WD_CAPS__ADD_OPTION
            __WD_Capabilities__Option($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_ARGUMENT
            __WD_Capabilities__Argument($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_PREFERENCE
            __WD_Capabilities__Preference($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_LOG
            __WD_Capabilities__Log($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_ENV
            __WD_Capabilities__Env($PARAM1, $PARAM2)
        Case $_WD_CAPS__BUILD
            Return __WD_Capabilities__Build($PARAM1)
    EndSwitch
EndFunc   ;==>_WD_Capabilities

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
On 9/2/2021 at 3:30 PM, Danp2 said:

Yes, I would recommend support for both options since that's in line with the W3C specs.

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?
 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites

I use this example:

https://developer.mozilla.org/en-US/docs/Web/WebDriver/Timeouts#setting_and_getting_timeouts_at_runtime

{"implicit": 4.5, "script": 300, "pageLoad": 30000}

and I add support for capability "timeouts" which have value as JSON object

__WD_Capabilities__Capability('timeouts', '{"implicit": 4, "script": 300, "pageLoad": 30000}')

 

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
1 hour ago, mLipok said:

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?

Both AFAIK.

19 minutes ago, mLipok said:

I add support for capability "timeouts"

I don't believe that I've ever needed to use timeouts in the Capacities string. I've always used _WD_Timeouts to get / set these values at runtime.

Link to post
Share on other sites
4 minutes ago, Danp2 said:

I don't believe that I've ever needed to use timeouts in the Capacities string. I've always used _WD_Timeouts to get / set these values at runtime.

But possibility to set this particular capabilitiy in this UDF is desirable ?

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
8 minutes ago, Danp2 said:
1 hour ago, mLipok said:

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?

Both AFAIK.


Does it mean that both "alwaysMatch" and "firstMatch" should have the same configuration possibilities, i.e. allow all "JSON Array" and all "JSON Objects" to be set in the same way ?

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
  • mLipok changed the title to wd_capabilities.au3 - support topic - BETA - Work In Progress
19 minutes ago, mLipok said:


Does it mean that both "alwaysMatch" and "firstMatch" should have the same configuration possibilities, i.e. allow all "JSON Array" and all "JSON Objects" to be set in the same way ?

Take a look here:

https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities#combining_alwaysmatch_and_firstmatch

{
  "capabilities": {
    "alwaysMatch": {
      "browserName": "firefox",
      "moz:firefoxOptions": {
        "profile": "<base64 encoded profile>",
        "args": ["-headless"],
        "prefs": {"dom.ipc.processCount": 8},
        "log":{"level": "trace"}
      }
    },
    "firstMatch": [
      {"platformName": "macos"},
      {"platformName": "linux"}
    ]
  }
}


"alwaysMatch": {JSON OBJECT}
"firstMatch"" [JSON ARRAY of {JSON OBJECT}]

Do I understand it correctly?

EDIT:
I mean that this {JSON OBJECT} should have the same settings, features.
But the "firstMatch" can have them duplicated for lets say "for many different scenarios"

for example:

image.png.eb97d67f9349659d5b5cd323af0a9703.png

Objects from line 5, 36, 66, 96, 126 .... they should be able to set the same content ?
Am I right ?

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites

Take a look on this concept:

Func _Example()
    ....
    ....
    ....
    #Region - create "alwayMatch" JSON Object   
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "alwaysMatch")
    #EndRegion
        
    
    #Region - create first JSON Object  in "firstMatch" JSON ARRAY
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "firstMatch")
    #Region - create alwayMatch JSON Object 
    
    #Region - create second JSON Object in "firstMatch" JSON ARRAY
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "firstMatch")
    #Region - create alwayMatch JSON Object 


    ; create entire Capability JSON
    Local $s_Desired_Capabilities = _WD_Capabilities_Build()

    ....
    ....
    ....
EndFunc

What you think about ?

It would be quite easy to achive, I only need to know if my understanding of "alwaysMatch" and "firstMatch" is correct ?

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 * 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

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 *

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: 2021-10-18

Link to post
Share on other sites
  • mLipok changed the title to wd_capabilities.au3 - support topic - early BETA version - Work In Progress

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By noellarkin
      This is for those pages that seem to load when you use _FFOpenURL(), but they have a text saying "please wait while we load your page..." but according to _FFOpenURL() the page has loaded.  An example seen in popular sites is the Cloudflare page saying "Checking your browser before...". It's the opposite of pausing a script until an element is visible on a page. It takes Elements in the form of id, xpath or text search.
      Global $BrowserPort = 4242 Global $TimeOut = 60000 Global $LocalHost = "127.0.0.1" Func _FFWaitWhileElement($thiselement, $elementtype = "xpath", $timeoutms = 60000) _FFConnect($LocalHost, $BrowserPort, $TimeOut) Local $Element Local $ElementFound = 1 Local $TimeoutCountdown = 0 While $ElementFound <> 0 And $TimeoutCountdown < $timeoutms If $elementtype = "xpath" Then $Element = _FFXPath($thiselement) EndIf If $elementtype = "id" Then Local $ConstructXPath = ".//*[@id='" & $thiselement & "']" $Element = _FFXPath($ConstructXPath) EndIf ; MsgBox(0, "", $Element) Local $ElementXPathTextContent = _FFCmd("FFau3.xpath.textContent") ; MsgBox(0, "", $ElementXPathTextContent) Local $ElementXPathInnerHTML = _FFCmd("FFau3.xpath.innerHTML") ; MsgBox(0, "", $ElementXPathInnerHTML) If $ElementXPathTextContent = "_FFCmd_Err" Or $ElementXPathInnerHTML = "_FFCmd_Err" Then $ElementFound = 0 Else $ElementFound = 1 EndIf If $elementtype = "text" Then $ElementFound = _FFSearch($thiselement) ; MsgBox(0, "", $ElementFound) EndIf $TimeoutCountdown += 1000 _FFDisConnect() _FFConnect($LocalHost, $BrowserPort, $TimeOut) WEnd Return $ElementFound EndFunc _FFConnect($LocalHost, $BrowserPort, $TimeOut) _FFOpenURL("https://www.site.com/page", True) _FFWaitForElement("Please Wait...","text", 60000) MsgBox(0,"","Page finished loading") It's pretty simple, hope it helps some of you who are working with FF.au3 :)
    • By noellarkin
      So I was trying to write a function that can find a button (or any other XPath Element) and scroll the page + move the mouse to the location of the button.
      My logic for this was:
      1. get position of button using _FFGetPosition
      2. get inner dimensions of browser window and total dimensions of page
      3. divide total dimensions by inner dimensions to get number of page down operations
      4. use Mod() to get remaining pixels offset
      5. MouseMove() and add requisite offsets for Titlebar etc (what the +5 and +54 is for in the last line)
      Example Code:
      _FFConnect($LocalHost, $BrowserPort, $TimeOut) Local $Button = _FFXPath(".//*[@id='thisbutton']") Local $ButtonPosition = _FFGetPosition($Button) Local $ElementWidth = $ButtonPosition[0] Local $ElementHeight = $ButtonPosition[1] Local $InnerWidth = _FFCmd("window.content.innerWidth") Local $InnerHeight = _FFCmd("window.content.innerHeight") Local $PageWidth = _FFCmd(".body.offsetWidth") Local $PageHeight = _FFCmd(".body.offsetHeight") Local $PGDNNo = Int($ElementHeight/$InnerHeight) Local $PGDNMod = Mod($ElementHeight, $InnerHeight) ; MsgBox(0,"","$ElementX: " & $ElementWidth & @CRLF & "$ElementY: " & $ElementHeight) ; MsgBox(0,"","$InnerWidth: " & $InnerWidth & @CRLF & "$InnerHeight: " & $InnerHeight) ; MsgBox(0,"","$PageWidth: " & $PageWidth & @CRLF & "$PageHeight: " & $PageHeight) ; MsgBox(0,"",$PGDNNo) ; MsgBox(0,"",$PGDNMod) Local $iter = 1 While $iter <= $PGDNNo WinActivate($BrowserWindowClass,"") _FFCmd("window.content.scrollByPages(1)") $iter += 1 WEnd MouseMove($ElementWidth + 5, $PGDNMod + 54) This isn't working. In some cases, it's not doing the page down operation the number of times needed, or not accurately pinpointing the location. I think there may be something wrong with the logic I'm using. What am I doing wrong?
      Thanks.
       
    • By mLipok
      Anybody could help with using QueryInterface in AutoIt to embed Microsoft Edge using WebView2 Interface ?
      Here are links to information/documentation:

      Image comes from: https://docs.microsoft.com/en-us/microsoft-edge/webview2/media/webview2/whatwebview.png
      Introduction to Microsoft Edge WebView2
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/

      Understand WebView2 SDK versions
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning
      Download:
      https://developer.microsoft.com/en-US/microsoft-edge/webview2/
      https://developer.microsoft.com/en-US/microsoft-edge/webview2/#download-section
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution
      API Reference:
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/?view=webview2-1.0.622.22

      HowTo/Concepts:
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/win32
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/debug?tabs=devtools
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/security
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/userdatafolder
      https://mybuild.microsoft.com/sessions/9198aeac-0c8e-4d32-96d1-cbb99a390aa6
      Example:
      https://github.com/MicrosoftEdge/WebView2Samples
      Related:
      https://www.essentialobjects.com/Products/WebBrowser/Default.aspx?gclid=CjwKCAiA17P9BRB2EiwAMvwNyMe6UI9VHej-JYDBUoyGDFz40KaaJ_RidY-75Fhr-PHz65sSVC0XlxoC5loQAvD_BwE
      https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/webdriver
       
      btw.
      I'm not WindowsApi expert (QueryInterface, C++, DllCall).
      What I trying to say is:     It means that I do not done anything in this regards .... as so far.
       
       
      TIMELINE/ChangeLog:
       
      2020-11-12 - Project propsed by @mLipok 2021-02-03 - First version provided by @LarsJ
    • By Danp2
      Introduction
      This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
      Requirements
      JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
      WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/
      HtmlTable2Array UDF (optional) https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/
      WebDriver for desired browser
      Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Source Code
      You will always be able to find the latest version in the GitHub Repo 
      Help / Support
      See the wiki for details on the UDF --
      https://www.autoitscript.com/wiki/WebDriver
      Please post any questions, suggestions or errors in the GH&S thread.
      https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/
      Previous support threads (Closed)
      https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/
      https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/
       
    • By Epulone
      For a specific requirement the outbound email are managed by an on-prem EDGE server. The EDGE re-write the local on-prem email address with another domain [exposed domain - mx record-]. Everything is working fine but we are having an issue when the internal local users are requesting an invite meeting by  Outlook calendar . In that case when the receiver accept the request invite it generate an error "domain not found". In this scenario the EDGE server is not able to rewrite also the calendar MIME request  (V-card) header inside the message so when the receiver accepts the request the reply [mechanism] will fails as will be used the email address of the local user  [domain not exposed ] and not the external one.
      I was wondering if Autoit is able to manipulate somehow the invite heade- calendar MIME (V-card))- re-witing the user email.   Thanks    
×
×
  • Create New...