Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/02/2022 in all areas

  1. Hé, everybody is entitled to their opinion and for sure don't feel personally attacked by somebody wanting to make those kind of statements.. The last time I worked on any of these UDFs was when there wasn't any option for sorting arrays so just converted some standard Basic Sort routines to AutoIt3, and that's about it.... nothing more nothing less and it has worked for me thus far as I never process larger arrays with AutoIt3 myself as they always go into a SQL server. Last time I worked on this was probably 15 years ago? Others have added other sorting routines to make it faster nd maintained it since then. So all I can say to the person making these kind of statements: Love you too. 😘
    2 points
  2. I wouldn't be so critical of a FREE and excellent product. @Jonhas no time to work on development and@Josdoes an excellent job of syncing the product with the latest updates to Scite apart from actively supporting this forum responding to many brain dead newbie queries.
    1 point
  3. Its not part of the core AutoIt to do the sorting and as with any UDF there are many different versions of it and if you look around on the forum you will find multiple other UDF's to do the array sorting stuff. The main question is for which purposes do you need speed for sorting arrays as basically when you need speed you should not be using AutoIt or scripting language but switch to compiled implementation (just like you did with the dll) See
    1 point
  4. Oops, I spoke too fast without thinking twice. Of course it does work in this context, my bad. I too have a number of VERY urgent things to do.
    1 point
  5. I must re read this couple of times, because I feel like I still live in 2021.
    1 point
  6. You're right, _ArraySort is an arthritic teethless sleepy dog with only one eye and three legs. I wanted to write a sort function in AutoIt working similar to C qsort(), that is: relying on a user-supplied collation function. That's the correct approach since only the user can write such collation suited to the array dimensions, datatypes and possibly complex collation (sort) criterions he needs to deal with. Else we see a number of useless parameters, endless variations of the _ArraySort function itself where users have to implant their collation right in the middle of the sort functions inside his own derivation of _ArraySort(). More worrisome is the fact that all this has to be done again for arrays with 1, 2, 3, ..., 24 dimensions. And done again if one column changes from string to integer, or any type change. And done again if the multi-column sort criterion change. Experienced users have learn to be hurt be these limitations and often have to write weird code and use unnatural way to store their data just because they know in advance how sorting an array the way they would have found natural is painful. That's why the dog badly needs a surgeon. For an AutoIt qsort() to work efficiently (in AutoIt), we need: an efficient way to declare an array programmatically regardless of its dimensions, an efficient way to extract/replace a multidimensional row of an array regardless the dimensions of the array. Ideally we'd love to have a way to extract/replace a multidimensional block out of an array regardless the dimensions of the array. We have none of these features. The way to circumvent the issue is either to convert back and forth every indivudual data cell to something a decent language can process, just like you did, or leave the dead body spoil rotten. It's a pity as it would only need few additions to completely change the game, for instance: Execute("Local $aNew[$n0][$n1][$n2][$n3][$n4]") ; create a new 5D array Local $aExtract = $aBigOne[{$i}] ; extract multidimentional row $i off array ... ; deal with $aExtract $aBigTwo[{$k}] = $aExtract ; assign multidimentional row in array row $k
    1 point
  7. That's because I used the setTimeout function to run the anonymous function with a delay of 3 seconds JavaScript doesn't have sleep function due to how it's designed, so we have to use work-around like callbacks and timers, and with modern ES6 version of JS we now have Promises and new keywords to simulate a procedural execution in async code. It can be a little hard to grasp if you aren't used to thinking that way. TL;DR JavaScript doesn't have sleep so async mode is required if you need to wait for anything in your code. As I explained above, the terms can be misleading. The advantage of using async mode is that you have more flexibility as you can call the "return function" whenever you want, that means being able to wait for something (e.g. an event) to occur, this wouldn't be possible in sync scripts because there is no sleep function.
    1 point
  8. Thanks for yours demo code. I used them in my testing script: #AutoIt3Wrapper_UseX64=N #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() Local $sSession = _MY__WD_SetupChrome(True) _WD_Navigate($sSession, 'https://www.google.com') Sleep(1000) Local $sJavaScript = 'setTimeout(() => arguments[0]("foobar"), 3000); return true;' Local $hTimer, $sResult $hTimer = TimerInit() $sResult = _WD_ExecuteScript($sSession, $sJavaScript, Default, True, "[value]") ConsoleWrite("! After $bAsync = True: Elapsed time = " & TimerDiff($hTimer) / 1000 & " $sResult = " & $sResult & @CRLF) $hTimer = TimerInit() $sResult = _WD_ExecuteScript($sSession, $sJavaScript, Default, False, "[value]") ConsoleWrite("! After $bAsync = False: Elapsed time = " & TimerDiff($hTimer) / 1000 & " $sResult = " & $sResult & @CRLF) _WD_Shutdown() EndFunc ;==>_Example Func _MY__WD_SetupChrome($b_Headless = False, $s_Download_dir = '', $_WD_DEBUG_LEVEL = Default, $s_Log_FileFullPath = Null) If $_WD_DEBUG_LEVEL = Default Then $_WD_DEBUG = $_WD_DEBUG_Error If Not @Compiled Then $_WD_DEBUG = $_WD_DEBUG_Info EndIf _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DefaultTimeout', 1000) _WD_UpdateDriver('chrome') If @error Then Return SetError(@error, @extended, '') # !!! WARRNING !!! AS DEFAULT DO NOT USE '--log-path=' BECAUSE OF GDPR / RODO law rules If $s_Log_FileFullPath = Default Then Local $s_Default_Log_File = @ScriptDir & '\Log\' & @YEAR & @MON & @MDAY & '-' & @HOUR & @MIN & @SEC & ' WebDriver - Chrome - Testing.log' _WD_Option('DriverParams', '--log-path=' & '"' & $s_Default_Log_File & '"') EndIf _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch') _WD_CapabilitiesAdd('acceptInsecureCerts', True) _WD_CapabilitiesAdd('firstMatch', 'chrome') _WD_CapabilitiesAdd('browserName', 'chrome') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('args', 'user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') _WD_CapabilitiesAdd('args', 'user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win' & StringReplace(@OSArch, 'X', '') & '; ' & @CPUArch & ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' & _WD_GetBrowserVersion('chrome') & ' Safari/537.36') _WD_CapabilitiesAdd('args', '--profile-directory', Default) _WD_CapabilitiesAdd('args', 'start-maximized') _WD_CapabilitiesAdd('args', 'disable-infobars') _WD_CapabilitiesAdd('args', '--no-sandbox') _WD_CapabilitiesAdd('args', '--disable-blink-features=AutomationControlled') _WD_CapabilitiesAdd('args', '--disable-web-security') _WD_CapabilitiesAdd('args', '--allow-running-insecure-content') ; https://stackoverflow.com/a/60409220 _WD_CapabilitiesAdd('args', '--ignore-certificate-errors') ; https://stackoverflow.com/a/60409220 _WD_CapabilitiesAdd('prefs', 'credentials_enable_service', False) ; https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-12272021/?do=findComment&comment=1464829 If $b_Headless Then _ _WD_CapabilitiesAdd('args', '--headless') If $s_Download_dir Then _ _WD_CapabilitiesAdd('prefs', 'download.default_directory', $s_Download_dir) _WD_CapabilitiesAdd('excludeSwitches', 'disable-popup-blocking') ; https://help.applitools.com/hc/en-us/articles/360007189411--Chrome-is-being-controlled-by-automated-test-software-notification _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation') _WD_CapabilitiesAdd('excludeSwitches', 'load-extension') _WD_CapabilitiesDump(@ScriptLineNumber & ':WebDriver: testing') Local $s_Capabilities = _WD_CapabilitiesGet() _WD_Startup() If @error Then Return SetError(@error, @extended) Local $WD_SESSION = _WD_CreateSession($s_Capabilities) Return SetError(@error, @extended, $WD_SESSION) EndFunc ;==>_MY__WD_SetupChrome and here is my console output: My question is : Why in Async mode code execution tooks 3 seconds , and in Sync mode code execution tooks 0.017 seconds ? I expected the opposite, I mean I expected that the execution time would be shorter in Async mode, and longer in Sync mode.
    1 point
  9. @mLipok I would interpret that to mean that frames located within another frame would not be included in the count.
    1 point
  10. I had to read the W3C spec to find out how async is different from sync execution. Turns out it's not very different from the sync version, the only difference is that your code gets an extra function argument (which is appended to the special arguments array) that you can call to signal that the script is done, you can also supply a value to this function which will be set as the return value. Here's the demo code I used to test this: _WD_ExecuteScript($sSession, 'setTimeout(() => arguments[0]("foobar"), 3000)', True) This does the same thing as: _WD_ExecuteScript($sSession, 'return "foobar"') but with a delay of 3 seconds. This feature is only useful in complex scripts which require waiting for something on the web-page.
    1 point
  11. Thanks so much for the tip. I found this bit of code that I added just before defining the GUI and it works perfectly! ;Make gui DPI AWARE... If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Then DllCall("User32.dll", "bool", "SetProcessDPIAware")
    1 point
×
×
  • Create New...