Jump to content

Leaderboard

Popular Content

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

  1. I've ported some of the JavaScript 140 Bytes demos from dwitter.net to FreeBasic. Download AiO with 1000 examples (7-Zip archive): The beauty - magic of math Vol. 1 - 23 build 2024-01-14.7z (5.09 mb with source code and Windows x64 compiled executables) or have a look to my 1drive folder: _dwitter.net Some screenshots: ... Autoit is too slow for almost all of these examples. Happy watching.
    3 points
  2. @mLipok You can try the Page.printToPDF CDP command, it allows you to specify many options, including paperWidth and paperHeight which seems to be exactly what you are looking for Maybe we can even modify the existing function in the helper UDF to use this for ChromeDriver
    1 point
  3. Hi, As the author of the last major review of the Array library (already 8 years ago!) when among other things 2D support was added, I feel absolutely no embarrassment at all for having done no further work on the library. Jon has often expressed his dissatisfaction with the way he implemented arrays in AutoIt - a major factor in the slowness of their manipulation - but at the time that was what he came up with and we have to live with it. As a result, and like many others, I only use the _ArraySort function to sort smallish arrays - anything of any size gets put into a SQLite database which even with my low level of SQL knowledge is quite fast enough for me. One of the major assets of AutoIt has always been its portability and the "stand-alone" nature of its compiled scripts. I would be very loath to see any additional requirement such as a DLL solely for array sorting. Not to mention the problem of getting such a file to install on machines without an existing AutoIt installation - there are already enough problems getting the standard files accepted. Remembering the very limited amount of support and testing (with some notable exceptions) I got during the library rewrite mentioned above I feel you are whistling in the dark here. But good luck with your efforts. M23
    1 point
  4. I still don't see exactly what your point is. You want the sorting function to be a built-in function of AutoIt and therefore speed up the actual sorting? Currently, the function is not part of the language but only (as in most languages) part of the standard library. Therefore, the sorting itself is written in (slowly) to be interpreted AutoIt code. Your current example deals with the case of converting the data of an AutoIt array into C form and sorting it there with a firmly compiled comparison function. For the example here, where 1,000,000 integers are to be sorted, your approach achieves a speed-up of a factor of 10 for me. To be fair, you could still switch to the dual pivot quicksort in _ArraySort, but even then it would still be a factor of at least 8x. Currently, I only see the proof that you can speed up the case of sorting a large integer array in this way - so currently still a very concrete case. I don't see a general replacement of the functionality of _ArraySort here yet. However, _ArraySort swallows all AutoIt data types and yes, you also try to cover all data types in principle via the void pointers. However, the approach with the dll becomes exciting at the latest when it comes to sorting an array of strings. Because there, a void pointer is no longer sufficient, but a length specification per element is also required. Anyway - that would still be solvable under certain circumstances. Whether it still brings the performance gain is another question. However, at the latest when it comes to sorting an array with a mixture of different data types - and yes, _ArraySort can of course do this - you end up in the situation of having to implement the variant type in the DLL. So far(!) I don't see any approach for a general replacement of _ArraySort in the example shown, but only an acceleration potential for special cases. The possibility of using own user-defined (i.e. written in AutoIt) comparison functions is also not yet available. You want to achieve this through DLLCallBackRegister - I know. However, I see massive problems with regard to the data types here as well. The real sticking points have not yet been solved, which is why I can't quite understand the vehemence and emphasis with which what is shown is being touted as the ultimate solution in this early phase. Build the DLL in such a way that it covers about 90% of the use cases of _ArraySort (i.e. first of all all data types - not even 2D arrays). If the performance advantage is then still so constant, then I would share your current euphoria. I therefore understand the post more as a call to the devs to implement a sorting function internally built into AutoIt? Sure: A sorting function as part of the language could handle the variant type more elegantly than an external dll. The connection to own sorting functions could also be better realised there. However, if you look at the speed of development of AutoIt in the last few years, I don't assume that the implementation effort required for this is even considered. Probably also because the user community has not yet expressed a corresponding need. Most see AutoIt as a scripting language with which their needs can be implemented quickly and easily. High performance is simply not expected by the users and if it is, other tools are used. If there are quick and easy ways to increase the performance in individual areas of AutoIt, no one will stubbornly refuse. However, I do not consider the concrete case here to be quick and easy.
    1 point
  5. 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. 😘
    1 point
  6. 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
  7. I must re read this couple of times, because I feel like I still live in 2021.
    1 point
  8. I was working on this and print properties: Here is my code #AutoIt3Wrapper_UseX64=N #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() Local $sSession = _MY__WD_SetupChrome(True) Local $sFilePath = @ScriptDir & "\PackingSlip.html" Local $s_HTML_File = "file:///" & StringReplace($sFilePath, "\", "/") ConsoleWrite("! $s_HTML_File = " & $s_HTML_File & @CRLF) _WD_Navigate($sSession, $s_HTML_File) ; https://www.w3.org/TR/webdriver/#print-page _Test($sSession, Default, 'PackingSlip_1_Default.pdf') ; https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-12272021/?do=findComment&comment=1478997 _Test($sSession, '{"pageRanges": ["1-2"]}', 'PackingSlip_1_PageRanges.pdf') ; https://www.autoitscript.com/forum/topic/206095-use-vba-code-with-firefox-in-webdriver/ _Test($sSession, '{"background": true}', 'PackingSlip_1_Background.pdf') ; https://stackoverflow.com/a/68353518/5314940 ; http://www.polger.wroclaw.pl/Formaty-papieru,51.html _Test($sSession, '{"pageWidth": 21.59, "pageHeight": 27.94}', 'PackingSlip_1_Letter.pdf') ; this are default values _Test($sSession, '{"pageWidth": 21.00, "pageHeight": 29.70}', 'PackingSlip_1_A4.pdf') _Test($sSession, '{"pageWidth": 29.70, "pageHeight": 42.00}', 'PackingSlip_1_A3.pdf') _WD_Shutdown() EndFunc ;==>_Example Func _Test($sSession, $sOptions, $sFileName) Local $dBinaryDataToWrite = _WD_PrintToPdf($sSession, $sOptions) Local $hFile = FileOpen(@ScriptDir & "\" & $sFileName, $FO_OVERWRITE + $FO_BINARY) FileWrite($hFile, $dBinaryDataToWrite) FileClose($hFile) EndFunc ;==>_Test 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 but I have issue with setting "pageWidth" and "pageHeight" _Test($sSession, '{"pageWidth": 21.59, "pageHeight": 27.94}', 'PackingSlip_1_Letter.pdf') ; this are default values _Test($sSession, '{"pageWidth": 21.00, "pageHeight": 29.70}', 'PackingSlip_1_A4.pdf') _Test($sSession, '{"pageWidth": 29.70, "pageHeight": 42.00}', 'PackingSlip_1_A3.pdf') The problem is with generated PDF each of them have 8,50 x 11,00 inches, but they should differ. So the main question is why such usage: _WD_PrintToPdf($sSession, '{"pageWidth": 29.70, "pageHeight": 42.00}') does not change the print parameters and thus the PDF file has incorrect page size. Any body know how to fix this ? PackingSlip.html
    1 point
  9. search for below and you will probably find a solution https://github.com/jlipps/simple-wd-spec#set-window-rect _WD_NewTab($sSession, True, -1, $sURL, ', width=1450, height=900')  _WD_Window($sSession, 'Rect', '{"width":1450, "height":900}') and webdriver mobile_emulation as an option setting when you start the webdriver capabilities = { browserName: 'chrome', chromeOptions: { mobileEmulation: { deviceName: 'Apple iPhone 5' } }
    1 point
  10. Here my backup files: FF_my_backups.zip
    1 point
  11. Nope @mLipok . Time for y'all to use your GoogleFu and find the answer yourself. 😄 P.S. I posted a link earlier to the W3C specs. That may help you identify a way to control the print options.
    1 point
  12. Or maybe this is what you want ? Global $fInterrupt = False HotKeySet("x", "_Interrupt") Local $hWnd Do $hWnd = WinWait ("none","none",1) Until $hWnd or $fInterrupt If $hWnd Then ConsoleWrite ("WinWait succeeded" & @CRLF) Else ConsoleWrite ("WinWait was interrupted" & @CRLF) EndIf Func _Interrupt() ; The HotKey was pressed so set the flag $fInterrupt = True EndFunc
    1 point
×
×
  • Create New...