All Activity
- Today
-
Gianni reacted to a post in a topic: Class syntax in AutoIt
-
Hi @Gianni You are right, that is indeed an oversight, thanks for telling me The issue has been fixed on the master branch now, but I'll wait a day or two before creating a new release, to verify no more small mistakes appear
-
Hi @genius257 Just a small oversight: I tried to "build" example.au3 from example.au3p using build.au3 the output file produced contains this little "flaw": If $pObj=0 Then Return $__AOI_E_POINTER "C:\Temp\au3class-master\Example\Example.au3"(30,40) : warning: $__AOI_E_POINTER: possibly used before declaration. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Temp\au3class-master\Example\Example.au3"(30,40) : error: $__AOI_E_POINTER: undeclared global variable. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ apart from this the created "object" works correctly.
-
Gianni reacted to a post in a topic: Class syntax in AutoIt
-
WebDriver - Login to a site
SOLVE-SMART replied to argumentum's topic in AutoIt General Help and Support
These wrapper functions, of my boilerplate repository (regarding the au3WebDriver) could be helpful for further tasks you may have ๐ . Best regards Sven -
SOLVE-SMART reacted to a post in a topic: Which possibilities do we have to embed a HTML page into a AutoIt GUI?
-
How to always compile AutoIt scripts as x86?
Darien replied to Darien's topic in AutoIt General Help and Support
I won't always remember. -
WebDriver - Login to a site
SOLVE-SMART replied to argumentum's topic in AutoIt General Help and Support
Hi @argumentum ๐ , your page do not have any @ids in the DOM available (at least for the /LoginForm/ page. So you have to search for indicators which will give you the correct elements to interact with. In this example page you could use the placeholder attribute for username and password and the name "Login" for the submit button as your selectors. In other words, you can use XPath for the three elements to interact (2x input, 1x button) like this: _Login() Func _Login() Local Const $sUsername = 'argumentum' Local Const $sPassword = 'your-password' Local Const $sUsernameSelector = '//form//input[@placeholder="Enter Username"]' ; or by name: [@name="uname"] Local Const $sPasswordSelector = '//form//input[@placeholder="Enter Password"]' ; or by name: [@name="psw"] Local Const $sSubmitButtonSelector = '//form//button[text()="Login"]' _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sUsernameSelector), 'value', $sUsername) _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sPasswordSelector), 'value', $sPassword) _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSubmitButtonSelector), 'click') EndFunc I didn't tested it right now, but I am relatively sure, this should work ๐ . How did I came up with the XPath? Okay, I am experienced with locator strategies, but in case you're not: Use Chrome (or Firefox) > right click on your target element > choose "inspect" > you are now in the DevTools ("Elements" tab) > right click on the highlighted DOM element (input or button) > choose Copy from the context menu > Copy XPath > Ctrl+F > paste your generated XPath in the search (optional) > this verifies the match > use this selector in the _WD_FindElement() function. But: This is often not very robust. It's usually better to improve the selector by the usage of a relative XPath (different XPath Axes). I hope this will answer your questions ๐ค . Best regards Sven -
How to always compile AutoIt scripts as x86?
Musashi replied to Darien's topic in AutoIt General Help and Support
You could insert #AutoIt3Wrapper_UseX64 = N on top of your script. -
DarkMode UDF for AutoIt's Win32GUIs
jpm replied to NoNameCode's topic in AutoIt Technical Discussion
@argumentumI don't know how you can color the updown in black and also the left part of the Tab control a coloring of the date control can be a good improvement too. I implement a GUISetDarkTheme($hGui) which working the same , no need to use a callback I hope somebody can help. -
Netol reacted to a post in a topic: How to set a tab as active?
-
I'd like to login to a site. ( https://www.werwer.org/testing/LoginForm/ ). How do I list the IDs or XPaths from HTML source. How do I submit to execute the login. Thanks
-
Thanks for finding that definition file argumentum. I was basing my trimming based off a colleague's work but I don't really know what all the data means. I do have the array trimming working off what he had deemed to be important. I can see I need to tweak things a little bit more. Thanks for the suggestion. Maybe I could try creating a new pipe delimited text file based on my cleaned up array and then copying that to my file. I think this might be a little cleaner than my current solution putting in all those extra quotes to work as a csv. As you can see, I currently have it set up to make a new tab and delete a tab (pretty clunky but it is what I band-aided together). If I wanted to copy the data instead of the whole tab into a sheet on a different workbook, what's the cleanest way to copy the whole sheet data to an existing sheet. I assume it would be something with _Excel_RangeCopyPaste but I am hung up on what to use for the $vSourceRange. Would it just be easiest to set the range like in VBA with creating a COM range object based off the $oWorkbook object? I'm open to trying a more efficient way. I think it would be something like this: Local $vSourceRange = $oWorkbook.ActiveSheet.Usedrange ;There is only ever going to be one sheet in this workbook. Otherwise should probably not use the ActiveSheet method.
-
funkey reacted to a post in a topic: Class syntax in AutoIt
-
Trying a WebDriver clean start but I could not
MarcoMonte replied to MarcoMonte's topic in AutoIt General Help and Support
I Will erase EVERYTHING and I Will start again IT has to work, no matter the cost -
Trying a WebDriver clean start but I could not
Danp2 replied to MarcoMonte's topic in AutoIt General Help and Support
Clearly it either finding another instance of chromedriver or there's an issue with the version you downloaded. -
Danyfirex reacted to a post in a topic: Class syntax in AutoIt
-
I've made a transpiler for converting AutoIt-like class syntax into AutoIt code. GIthub: https://github.com/genius257/au3class/ Example for the syntax: #include-once Class Example $property = Null Func __construct($ts = 'now') $this.property = 0 EndFunc Func __destruct() ; Destructor code here. EndFunc Func method() Return "something" EndFunc Get Func dynamic() Return $this.dynamic & $this.property EndFunc Set Func dynamic($value) $this.property += 1 $this.dynamic = $value EndFunc EndClass $oExample = Example() $oExample.dynamic = 12 MsgBox(0, "", $oExample.dynamic) MsgBox(0, "", $oExample.method()) $oExample = Null class properties are defined as variables within the Class structure class methods are defined as function declarations within the Class structure property getters and setters need to have Get or Set in front of their function declaration Getter and setter can access their own underlying property, without triggering the getter or setter for said variable. Version 2 produces more code than version 1, but does not need any other scripts included to work. Version 2 is also faster than version 1, since version 2 creates specific code for looking up class members, instead of relying on AutoItObject_Internal with it's dynamic properties lookup. See the example folder on Github for building and using this: https://github.com/genius257/au3class/tree/master/Example
-
Trying a WebDriver clean start but I could not
MarcoMonte replied to MarcoMonte's topic in AutoIt General Help and Support
Helloooo, here I am... again... unfortunately I cannot validate the installation of Chromedriver... I took all the au3 files wd_Core.au3, wd_helper.au3 , wd_cdp.au3 , wd_capabilities.au3 from the WebDriver UDF Json.au3 and BinaryCall.au3 from the JSON UDF WinHttp.au3 and WinHttpConstants.au3 from the WinHttp UDF and put them into the au3 files directory, than I downloaded Chromedriver "chromedriver win64 https://storage.googleapis.com/chrome-for-testing-public/125.0.6422.60/win64/chromedriver-win64.zip" and put it inside the same directory of wd_demo, clicking on wd_demo appear the gui, I select "chrome" from browser and go for "run" it comes a error "check logs", It creates a files called Chrome, reading that file I thought got a wrong webdriver but I cannot see others suitable webdriver for my browser, "Chrome รจ aggiornato Versione 125.0.6422.61 (Build ufficiale) (a 64 bit)" <---- My browser chromedriver win64 https://storage.googleapis.com/chrome-for-testing-public/125.0.6422.60/win64/chromedriver-win64.zip" <---- my webdriver from here https://googlechromelabs.github.io/chrome-for-testing/ Here the logs I found after running wd_demo set on "Chrome" [1716207842.173][INFO]: Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 9515 [1716207842.173][INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. [1716207843.944][INFO]: [37d3147aafd38edcab6334fdeb294b9b] COMMAND InitSession { "capabilities": { "alwaysMatch": { "goog:chromeOptions": { "excludeSwitches": [ "enable-automation" ], "w3c": true } } } } [1716207843.955][INFO]: Populating Preferences file: { "alternate_error_pages": { "enabled": false }, "autofill": { "enabled": false }, "browser": { "check_default_browser": false }, "distribution": { "import_bookmarks": false, "import_history": false, "import_search_engine": false, "make_chrome_default_for_user": false, "skip_first_run_ui": true }, "dns_prefetching": { "enabled": false }, "profile": { "content_settings": { "pattern_pairs": { "https://*,*": { "media-stream": { "audio": "Default", "video": "Default" } } } }, "default_content_setting_values": { "geolocation": 1 }, "default_content_settings": { "geolocation": 1, "mouselock": 1, "notifications": 1, "popups": 1, "ppapi-broker": 1 }, "password_manager_enabled": false }, "safebrowsing": { "enabled": false }, "search": { "suggest_enabled": false }, "translate": { "enabled": false } } [1716207843.956][INFO]: Populating Local State file: { "background_mode": { "enabled": false }, "ssl": { "rev_checking": { "enabled": false } } } [1716207843.960][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-pre-commit-input --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\Marco\AppData\Local\Temp\scoped_dir9376_481513447" data:, [1716207844.236][DEBUG]: DevTools HTTP Request: http://localhost:63839/json/version [1716207844.580][DEBUG]: DevTools HTTP Response: { "Browser": "Chrome/125.0.6422.61", "Protocol-Version": "1.3", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36", "V8-Version": "12.5.227.8", "WebKit-Version": "537.36 (@0e32b459e15a72d5ffe73ffa8a7d92c2f278e1ff)", "webSocketDebuggerUrl": "ws://localhost:63839/devtools/browser/02599d6c-198e-45da-bece-b00c78b607f5" } [1716207844.580][INFO]: Failed to connect to Chrome. Attempting to kill it. [1716207844.682][INFO]: [37d3147aafd38edcab6334fdeb294b9b] RESPONSE InitSession ERROR session not created: This version of ChromeDriver only supports Chrome version 111 Current browser version is 125.0.6422.61 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [1716207844.683][DEBUG]: Log type 'driver' lost 0 entries on destruction [1716207844.683][DEBUG]: Log type 'browser' lost 0 entries on destruction The line: "RESPONSE InitSession ERROR session not created: This version of ChromeDriver only supports Chrome version 111 Current browser version is 125.0.6422.61 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" makes me think I am using an old version of Chromedriver but I am sure to use the new one... advises? -
IUIAutomation MS framework automate chrome, FF, IE, ....
SEKOMD replied to junkew's topic in AutoIt Example Scripts
This is most likely not possible, but I will ask - is it possible to insert html content into a page in Chrome using UIAutomation (for example, by setting an h2 tag to a blank about:blank page)? -
IUIAutomation MS framework automate chrome, FF, IE, ....
SEKOMD replied to junkew's topic in AutoIt Example Scripts
Please tell me how to disable event focus in _UIA_action? For example command: _UIA_action($oUIElement,"setValue", "test text") activates the window, how to disable it? -
Correct...they are pipe delimited. I'm doing a little data manipulation with an AutoIt array (trimming out some fat that isn't relevant to us)...and now I'm trying to get the data into our Caspio app (which requires Excel formatted values, so I'm trying to convert my array to that format. Here's my current workaround (I'm not sure if this will exactly work for you as I may be missing some data) that now works decently: Func WriteDataToWorkbook($sSheetName, $aInput, $sFormat = "Excel") Local $iMatch Switch $oWorkbook.Sheets(1).Name Case "Sheet1" ;There is only one sheet...rename the existing sheet $oWorkbook.Sheets(1).Name = $sSheetName Case Else ;The first sheet has already been renamed...add a new sheet to the workbook (if it doesn't already exist). Local $aSheets = _Excel_SheetList($oWorkbook) ;_ArrayDisplay($aSheets) $iMatch = _ArraySearch($aSheets,$sSheetName,0,0,0,0,1,0) Switch $iMatch Case -1 ;The sheet doesn't exist...add it. _Excel_SheetAdd($oWorkbook, -1, False, 1, $sSheetName) Case Else ;The sheet already exists...overwrite it's contents EndSwitch EndSwitch ;Write data to the range. Switch $sFormat Case "CSV" Local $sTempCSV = WriteDataToWorkbookViaCSV($aInput) Local $oSOURCE = _Excel_BookOpen($oExcel,$sTempCSV,True) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sTempCSV, $sDrive, $sDir, $sFileName, $sExtension) _Excel_SheetCopyMove($oSOURCE, Default, $oWorkbook, $sSheetName, False, True) _Excel_SheetDelete ($oWorkbook, $sSheetName) $oWorkbook.Sheets($sFileName).Name = $sSheetName _Excel_BookClose($oSOURCE, False) ;Close the source file FileDelete($sTempCSV) Case Else _Excel_RangeWrite($oWorkbook, $sSheetName, $aInput, Default, True) EndSwitch ;MsgBox(0,0,0) EndFunc ;==>WriteDataToWorkbook Func WriteDataToWorkbookViaCSV($aInput) Local $sLineToWrite Local $sTempFile = _TempFile(Default,"",".csv") ConsoleWrite($sTempFile & @CRLF) Local $hFileOpen = FileOpen($sTempFile, $FO_OVERWRITE) Local $sTempCSV For $i = 0 To UBound($aInput) - 1 $sLineToWrite = '"' & _ArrayToString($aInput, '","', $i, $i, "") & '"' & @CRLF ;ConsoleWrite($sLineToWrite) FileWrite($hFileOpen, $sLineToWrite) ;ConsoleWrite("------------" & @CRLF & $sTempCSV & @CRLF & "------------" & @CRLF) ;MsgBox(0,0,0) Next Return $sTempFile EndFunc I guess I'm curious if someone has a better solution than this that isn't so brute force. My big change from before and now is I was trying to create a super long variable to a file and I flipped it to the current format with the filewrite with a handle.
-
they are pipe delimited: HS|REG|A0076610|1065953|1096978|07/09/1999|Application Granted HS|REG|A0029394|1024646|125847|07/13/1999|Duplicate Registration Request Received HS|REG|A0006880|1005846|111122|07/14/1999|Registration Terminated HS|REG|A0006880|1005846|111122|07/14/1999|Supercede - Internal Correction Applied HS|REG|A0075991|1065334|1096997|07/14/1999|Application Granted So, what is your need/problem/wish ?
-
I'm trying to write a large dataset to a range but am struggling to see if anyone can come up with a suggestion on how to fix this. Overall, this data is completely public and from the FCC (Data is HERE...the RA.dat, CO.dat, and EN.dat files in the zip) and I'm just trying to get it into an app to make the data more accessible and automated. I have trimmed up the trouble code and posted below (it does work with small datasets). I currently have code that can download the zip, unzip it, convert the file to an array, and then I just want to write it to excel so I can import it into our internal app. The code is below: Func WriteDataToWorkbook($sSheetName, $aInput) Local $iMatch Switch $oWorkbook.Sheets(1).Name Case "Sheet1" ;There is only one sheet...rename the existing sheet $oWorkbook.Sheets(1).Name = $sSheetName Case Else ;The first sheet has already been renamed...add a new sheet to the workbook (if it doesn't already exist). Local $aSheets = _Excel_SheetList($oWorkbook) ;_ArrayDisplay($aSheets) $iMatch = _ArraySearch($aSheets,$sSheetName,0,0,0,0,1,0) Switch $iMatch Case -1 ;The sheet doesn't exist...add it. _Excel_SheetAdd($oWorkbook, -1, False, 1, $sSheetName) Case Else ;The sheet already exists...overwrite it's contents EndSwitch EndSwitch ;Write data to the range. _Excel_RangeWrite($oWorkbook, $sSheetName, $aInput, Default, True) EndFunc ;==>WriteDataToWorkbook The code will paste data...but it eventually has the columns not matching up and then the bottom of the dataset returns #N/A's. I have confirmed that the array that gets generated is correct. As a workaround, I'm trying to write the data to a temp csv and then moving that data to my Excel workbook, but that seems to be quite slow. Overall, I think I probably could get by without getting this working as there is daily data that comes out (which is much smaller). I just need to get the full dataset processed manually. However, there is anther large dataset that does work, but I worry at what point this behavior will occur. Thanks for your help!
-
Code to obtain only the first file of the a lot of folders
Netol replied to Netol's topic in AutoIt General Help and Support
Thanks a lot. Work fine! best regards - Yesterday
-
@Gianni Very clever code you made there. I was not aware of it, thank you for sharing. I had a bit of a hard time understanding the behavior of $x. So I changed it (hope you don't mind ) to make it, IMO, easier to read. Func IsArrayEmpty(ByRef $aMyArray) If Not IsArray($aMyArray) Then Return SetError(1, 0, -1) Local $iDimensions = UBound($aMyArray, 0) Local $sArraySubscript = "$aMyArray" For $i = 0 To $iDimensions - 1 $sArraySubscript &= '[$aLoops[' & $i & '][1]]' Next Local $aLoops[$iDimensions][2] For $i = 0 To $iDimensions - 1 $aLoops[$i][0] = UBound($aMyArray, $i + 1) $aLoops[$i][1] = 0 Next Local $vContent, $IsEmpty Do $vContent = Execute($sArraySubscript) If IsArray($vContent) Then $IsEmpty = IsArrayEmpty($vContent) ; <-- recursive call for nested arrays Else ; check out your "voidness" logic here ; ------------------------------------ $IsEmpty = (Not $vContent) ; ...... up to you decide EndIf If Not $IsEmpty Then Return False ; Is not Empty For $i = 0 To $iDimensions - 1 $aLoops[$i][1] = Mod($aLoops[$i][1] + 1, $aLoops[$i][0]) If $aLoops[$i][1] Then ExitLoop Next Until $i = $iDimensions Return True ; Is Empty EndFunc ;==>IsArrayEmpty
-
Code to obtain only the first file of the a lot of folders
ioa747 replied to Netol's topic in AutoIt General Help and Support
another approach ; https://www.autoitscript.com/forum/topic/211902-code-to-obtain-only-the-first-file-of-the-a-lot-of-folders/ #include <File.au3> _FindAllDir(@MyDocumentsDir) ;---------------------------------------------------------------------------------------- Func _FindAllDir($dir) If StringRight($dir, 1) <> "\" Then $dir &= "\" $ArraySrtfiles = _FileListToArrayRec($dir, "*", $FLTAR_FOLDERS, $FLTAR_RECUR) If Not IsArray($ArraySrtfiles) Then ConsoleWrite($dir & " = Invalid input path" & @CRLF) Return Else Local $sResult For $x = 1 To $ArraySrtfiles[0] ;ConsoleWrite($dir & $ArraySrtfiles[$x] & @CRLF) $sResult = _FindAllFile($dir & $ArraySrtfiles[$x], "*.txt") If Not @error Then ConsoleWrite($sResult & @CRLF) Next EndIf EndFunc ;==>_FindAllDir ;---------------------------------------------------------------------------------------- Func _FindAllFile($dir, $FileMask) $ArraySrtfiles = _FileListToArrayRec($dir, $FileMask, $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT) If Not IsArray($ArraySrtfiles) Then Return SetError(1, 0, "") Else Local $sResult For $x = 1 To $ArraySrtfiles[0] $sResult = $dir & $ArraySrtfiles[$x] Return $sResult Next EndIf EndFunc ;==>_FindAllFile ;----------------------------------------------------------------------------------------