Leaderboard
Popular Content
Showing content with the highest reputation on 02/28/2019 in all areas
-
Hello. Write it in that way you will not affect @error and @extented. Saludos2 points
-
This might work. Local $str = 'I need to find dates such as "31-01-2018" and "21-02-2018"' & @CRLF & _ ' 13-3-2018 and "1-4-2018"' Local $aMnth[13] = [12, "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"] Local $sModifiedStr = Execute("'" & StringRegExpReplace($str, "(\d{1,2}).(\d{1,2}).(\d{2,4})", "'&$1&'-'&$aMnth[$2]&'-$3") & "'") ; Or ;Local $sModifiedStr = Execute("'" & StringRegExpReplace($str, "(\d{1,2}).(\d{1,2}).(\d{2,4})", "'&StringRight('00'&$1,2)&'-'&$aMnth[$2]&'-$3") & "'") ; One digit day (n) to two digit day (0n). ConsoleWrite($sModifiedStr & @CRLF)2 points
-
Delete files Every (n)Seconds
FrancescoDiMuro and one other reacted to Earthshine for a topic
I wouldn’t employ anyone not willing to write code properly. That’s not something that’s generally tolerated at other companies. It means you’re not a team player2 points -
Delete files Every (n)Seconds
Earthshine and one other reacted to Nine for a topic
@Dwalfware Have you ever heard about indentation ? Because it is really unpleasant to read your code. IMHO.2 points -
The GUI looks like shown in the picture: It contains a main menu, a treeview in left pane that lists UI Automation elements, a listview in right pane that displays detail information for the selected element, and a splitterbar to adjust the width of the two panes. Detect element The "Detect element" main menu is used to detect elements under the mouse with function keys F1 - F4. See How to topics number 2. Left pane The left pane is a treeview that initially lists open programs and windows. Generally, the left pane shows UI Automation elements represented as treeview items. Right pane The right pane is a listview that displays detail information for the selected treeview element. The information is grouped into different types of information. Only the relevant information for each type is displayed. Invalid elements When a window is closed the elements in UIASpy becomes invalid. But the elements are not deleted in UIASpy and can still be handled and selected in the treeview. Detail information for an element that was calculated before the window was closed can still be seen in the listview. In this way it's possible for UIASpy to show information for eg. a context menu that is closed as soon as it loses focus. Listview features Listview features Help system With completion of the Help system, a lot of information has been moved from this post and other posts into the Help system. Sample code creation Sample code creation is implemented through the UI element Detail info listview page and through the Sample code main menu. Sample code creates code snippets based on data in one or more selected rows in the Detail info listview page or based on the clicked Sample code menu item. UI Automation code is largely based on COM interface objects and thus on the function ObjCreateInterface(), which is one of the advanced functions in AutoIt. The main purpose of Sample code functionality is to eliminate the complexity of ObjCreateInterface(). Sample code creation either through the Detail info listview page or through the Sample code main menu can create all the interface objects required in UI Automation code. Another purpose is of course to make it easier and faster to implement code for simple automation tasks. Through Sample code creation, you can more or less create all code in a simple automation task: Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary Note that the UI element used in sample code is named after the selected element in the treeview. Also note that both the Sample code menu items and the sections in the Detail info listview page are placed in approximately the order they are used in a simple automation task. Sample code creation through Detail info listview page Sample code creation through Sample code main menu Supported applications Most browsers including Google Chrome To be able to spy on web content in Google Chrome it's necessary to enable accessibility by entering chrome://accessibility/ in the address bar of a new tab item, and then check the five check boxes that are located in a column in upper left corner down along the left edge. Then the accessibility tab can be closed again. It's a global setting that applies to all open and new tabs until Chrome is closed. Without accessibility enabled you are only able to investigate the outer elements of Chrome but not web content. Internet Explorer Microsoft Edge Mozilla Firefox Most Microsoft applications and applications developed with Microsoft software including Classic Windows applications based on the standard control library Modern Universal Windows Platform apps like the Windows 10 Calculator Programs implemented through .NET Framework eg. Windows Forms applications Most applications provided by major development companies Automation issues Automation issues How to topics If UI Automation or the UIASpy tool is new to you, then you should read the How to topics. Examples Examples that demonstrates the features of UIASpy: Automating Notepad. Very detailed example. Automating Notepad - Windows XP Examples about Sample code creation: Automating Notepad with Sample code - step by step Automating Notepad with Sample code - all at once Chrome - Clicking an extension. Compact summary example. Click Save As... issue in Notepad examples: Using Expand() instead of Invoke() Updates Windows 8, Windows 8.1 and Windows 10 updates Threads UI Automation UDFs contains all include files. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source files for UIASpy GUI. Note that UI Automation UDFs must be installed in the Includes folder. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. UIASpy.7z1 point
-
1/02/2018: Uploaded a new SciTe4AutoIt3.exe v19.102.1901.0 installer. This version contains the bugfix release for SciTE 4.1.2. There has been a major update for Tidy allowing now inline comments without them being shifted to the left by default. See this thread for the total story about the new behavior and the added options ==> SciTE4AutoIt3 v19.102.1901.0 Enjoy, Jos Addition/Changes/Fixes in the current installer: -------------------------------------------------------------------------------------------------- 2-1-2019 *** Merged the SciTE v 4.1.2 by Neil Hodgson with our own version of SciTE. (Jos) - Fixed regex issue for Alt+F in AutoItTools.lua - Fixed another regex issue for several functions in AutoItTools.lua - Fixed Header parameters now showing None when none are - Fixed jump to function to also jump to the right Column again. - Restored AutoItTools:Copy_BookMarks() functionality *** Updated AutoIt3Wrapper v19.102.1901.0 (Jos) - 18.703.1808.1 renamed "#AutoIt3Wrapper_Au3Stripper_Stop_OnError" to "#AutoIt3Wrapper_Au3Stripper_OnError" with now as options S,C,F,Stop,Continue,ForceUse - 18.708.1148.1 Added #include <WinAPIFiles.au3> back in the included file list to ensure backward compatibility. - 18.708.1148.2 Added "Tidy_Stop_OnError" support to the AutoIt3Wrapper.INI file. Changed HiDPI settings for Win 10 compatibility. - 18.708.1148.4 Added logic to be able to display Console Output of script that have #RequireAdmin while SciTE runs at normal level. - 18.708.1148.5 Added support to allow to Stop Execution or Restart for scripts with #RequireAdmin while SciTE runs at normal level. It won't hang anymore when you reply No on the UAC and detect the elevated process didn;t start. - 18.708.1148.6 Reverted HiDPI changes made in 18.708.1148.2 as problems are reported. needs investigation. - 18.708.1148.7 Changed check for RequireAdmin AutoIt3Wrapper startup. - 18.708.1148.8 Added #include <APIResConstants.au3> for backwards compatibility with AutoIt3 v3.3.14.x. *** Updated Au3Stripper v19.102.1901.0 (Jos) - 18.708.1148.1 Fixed issue finding variable names on multiline statements - 18.708.1148.2 Added check for ending \ in the AutoIt3Dir, and remove it when there, to avoid duplication of includes. - recompiled with PellesC 6 to make it compatible with WinXP again. *** Updated SciTEConfig v19.102.1901.0 (Jos) - 18.708.1148.1 Update to allow comments in *.SciTEConfig file lines. (JPM) This update includes the updated shemes to allow changing between them. *** Updated Tidy v19.102.1901.0 (Jos) - 18.708.1148.1: Fix bug handling Directivelines ending with continuation character - 18.708.1148.2: Fixed indentation when a "None breaking space"(C2A0) character is used in a UTF file. - 18.708.1148.3: Fix bug when a continuation line starts with +x, where is would add a space between +- and number. - 18.708.9999.x: Rewrite of some internal code to allow inlinecomments to remain at their current position. Details can be found in this post: https://www.autoitscript.com/forum/topic/196221-tidy-major-update-27-10-requesting-help-with-testing/ - 18.708.9999.22: Released to Beta. - 18.708.9999.23: Added option to totally skip commentblocks so now the options are: #Tidy_Parameters=/tcb=0 =>only indent the whole commentblock (default) /tcb or /tcb=1 =>Tidy inside commentblock /tcb=-1 =>leave whole commentbock alone Tidy.INI:#--> Tidy commentblock 0=only indent the whole commentblock (default=0) # 1=Tidy inside commentblock # -1=leave whole commentbock alone Tidy_commentblock=0 - 18.708.9999.24: Added check for ending \ in the AutoIt3Dir and remove it when there. - recompiled with PellesC 6 to make it compatible with WinXP again. -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates. ==> Visit the SciTE4AutoIt3 Download page for the latest versions ==> Check the online documentation for an overview of all extra's you get with this installer.1 point
-
@Danp2 There was a backlevel WinHTTP version: 1.6.3.7 Now running on WinHTTP version: 1.6.4.1 and it works great Many thanks for your support1 point
-
AutoIT and PowerShell/Python
Earthshine reacted to LarsJ for a topic
I would like to make a few comments on the example that junkew and Earthshine have referred to. The example is about handling (large) AutoIt arrays through compiled code. There are two ways to handle AutoIt arrays with compiled code. One is to use C# or VB code through .NET Framework. This is clearly the easiest way. Arrays are simply passed back and forth between AutoIt and compiled code as parameters in object methods. The other way is to use a standard dll-file implemented in C/C++ or similar languages. Arrays are passed back and forth between AutoIt and functions in the dll-file as pointers to safearrays. This way is more difficult because you are forced to deal with safarrays. Safearrays because native AutoIt arrays internally are stored as safearrays. This is described in Accessing AutoIt Variables. A few days ago there was a question (Limits to StringSplit?) that partly reminds of the problem described in first post above. The question was about how to handle a 1GB csv-file with 60 million rows. The problem is that AutoIt only handles arrays up to 16 million elements and isn't fast to handle such large amounts of data. There were two suggestions for solving the problem. One suggestion by jchd is based on using SQLite. The second proposal is based on using VB code through .NET Framework. The two suggestions resemble each other in that they are both based on adding some additional functionality to AutoIt, so that the problem can be handled. The SQLite solution requires access to the SQLite dll-file and a database must be created. This is relatively easy through SQLite.au3 UDF. Then there is complete database functionality in AutoIt. In addition, the SQL language is necessary. The VB.NET solution requires access to .NET dll-files, the VB code must be loaded from the source file and compiled and objects created. This is relatively easy through DotNetAll.au3 UDF. Then compiled and multi-threaded code can be used in AutoIt and very large arrays can be handled. In addition, the VB (VB.NET) language is necessary. For the problem described in first post I would recommend a VB.NET solution. Maybe an SQLite solution cannot be excluded.1 point -
WebDriver UDF (W3C compliant version) - 2024/09/21
Danp2 reacted to abberration for a topic
Awwwwww Snap! When Firefox changed to Quantum, the new version didn't support Mozrepl. This is key for a little program I made and because of this, I haven't upgraded my browser. Last year, I came to the forum looking for an alternative and found someone else already asked the question and everyone told him/her to use UI Automation. Well, I tried it and I couldn't get it to wait until the page fully loaded before going on with the script, so that didn't work for me. Just found this UDF and I think it will do everything I need. Danp2, great work. Now I have some code to re-write.1 point -
@Exit Your code ran correctly in my tests. Please see if you can isolate the cause of this issue on your end.1 point
-
Delete files Every (n)Seconds
pixelsearch reacted to Dwalfware for a topic
I would like to point this Post out to the MOD as it seems some cyber bulling going on here is rapid with the normal lot. Though I appreciate them helping people, they also forgot about compassion to newbies looking for help. You can address the situation or allow them to continue treating people poorly looking for help. It is not the AUTOIT I know and loved. Clearly just a lot of baiting to get expelled from the forums. Some empathy would greatly improve things.1 point -
Replace a part only of a regex
FrancescoDiMuro reacted to Skysnake for a topic
You're a beast And I mean that in a nice way Thx1 point -
Delete files Every (n)Seconds
FrancescoDiMuro reacted to Earthshine for a topic
You’re not making anything harder except for yourself and the other probably think you’re stupid Anyone can run tidy on your nonsense code and being belligerent and making it difficult is a dead giveaway to a bad employee You can’t work for professionals that’s for sure because they wouldn’t allow this. There are such things as code reviews. Anyway have fun being a belligerent employee and writing crappy code1 point -
Delete files Every (n)Seconds
Earthshine reacted to Dwalfware for a topic
Good, that is your preference. Thankfully there are MILLIONS of employers out there and very few coders, each with their own style and more than 90% of them like to code in ways what secure them their jobs with out been rotated out for cheaper labor. Many holding the I.P of their code in their agreements. Just the way it is. Are you sure you're not British? They like these null contracts.1 point -
Replace a part only of a regex
Skysnake reacted to FrancescoDiMuro for a topic
@Skysnake Another possible solution #include <Date.au3> #include <DateTimeConstants.au3> #include <StringConstants.au3> Global $arrDates[12] = ["31-01-2019", "01-02-2019", "02-03-2019", "03-04-2019", "04-05-2019", "05-06-2019", _ "06-07-2019", "07-08-2019", "08-09-2019", "09-10-2019", "10-11-2019", "11-12-2019"] For $i = 0 To UBound($arrDates) - 1 Step 1 ConsoleWrite("Old Date: " & $arrDates[$i] & @CRLF & _ "New Date: " & _MonthDigit2String($arrDates[$i]) & @CRLF & @CRLF) Next Func _MonthDigit2String($strDate) Local $arrResult = StringRegExp($strDate, "\d{2}\-(\d{2})\-\d{4}", $STR_REGEXPARRAYMATCH), _ $strMonth = (IsArray($arrResult) ? $arrResult[0] : 0) If $strMonth > 0 Then Return StringRegExpReplace($strDate, "(\d{2}\-)\d{2}(\-\d{4})", "$1" & _DateToMonth($strMonth, $DMW_SHORTNAME) & "$2") ; Executed only if $strMonth <= 0 Return False EndFunc1 point -
...furthermore, for almost "any" type of styles applicable on ListViews I suggest to also take a look at this link (https://www.autoitscript.com/forum/topic/181346-colors-and-fonts-in-custom-drawn-listviews-udf-version/) and also to the @LarsJ's signature, in the sesions related to the listview's topics...1 point
-
like this? Local $oIE = _IECreate("http://127.0.0.1",0,0,0,0) _IELoadWait($oIE) _IEQuit($oIE)1 point
-
This doesn't look correct. Unsure why it would be returning an exception here. I can look into it, but probably not until tomorrow.1 point
-
Delete files Every (n)Seconds
Earthshine reacted to Nine for a topic
I suppose it is the best excuse you could find to make most poorly written scripts...1 point -
Nice way to code. Now the questions remains: if the data is going to accumulate in large or huge chunks like this and if the OP needs to more or less regularly perform some querying or processing on global data, then a Db is certainly useful. If all this is a one-time shot then of course such direct fast processing is wonder. I've finally found a time to create an SQLite Db. The 58320000 rows are in fact 10800 groups numbered 0 to 10799 (column 2), of 5400 entries each numbered 0 to 5399 (column 3). I take the first column is storing a value. The whole thing seems to be an array like $aValue[10800][5400]. SQL isn't the best data store for arrays, yet all depends on which kind of processing will have to be done and what's the future of data (transient, permanent, accumulative, etc.).1 point
-
Using C# and VB Code in AutoIt through .NET Framework is another way to handle large files. I've tested some VB code with the large CSV-file with 58,320,000 rows: Imports System Imports System.IO Class CSVClass Public Function CSVFunc() As Integer(,) 'Load CSV file Console.WriteLine( "Load CSV file" ) 'Dim sPath As String = "test.csv" Dim sPath As String = "LARGE_elevation.csv" Dim aFile() As String = File.ReadAllLines( sPath ) Dim iRows As Integer = aFile.Length Console.WriteLine( "Rows in file = {0}", iRows ) 'To 2d array of integers Console.WriteLine( "To 2d array of integers" ) Dim aLine As Object() Dim aData(iRows-1,2) As Integer For i As Integer = 0 To iRows-1 aLine = aFile(i).Split(",") For j As Integer = 0 To 2 aData(i,j) = aLine(j) Next Next Console.WriteLine("First row: [{0}, {1}, {2}]", aData(0,0), aData(0,1), aData(0,2) ) Console.WriteLine("Last row: [{0}, {1}, {2}]", aData(iRows-1,0), aData(iRows-1,1), aData(iRows-1,2) ) 'Return 2d array slice Console.WriteLine( "Return 2d array slice" ) iRows = 100000 Dim aSlice(2,iRows-1) As Integer For i As Integer = 0 To iRows-1 aSlice(0,i) = aData(i,0) aSlice(1,i) = aData(i,1) aSlice(2,i) = aData(i,2) Next Return aSlice End Function End Class #AutoIt3Wrapper_UseX64=y #include <Array.au3> #include "DotNetAll.au3" Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $hTimer = TimerInit() Local $oNetCode = DotNet_LoadVBcode( FileRead( "CSVLoad.vb" ), "System.dll" ) Local $oCSVClass = DotNet_CreateObject( $oNetCode, "CSVClass" ) Local $aSlice = $oCSVClass.CSVFunc() ConsoleWrite( "Time = " & TimerDiff( $hTimer ) & @CRLF ) _ArrayDisplay( $aSlice ) EndFunc SciTE output: Load CSV file Rows in file = 58320000 To 2d array of integers First row: [222425, 0, 0] Last row: [16721411, 10799, 5399] Return 2d array slice Time = 55018.3823743302 That's a million rows per second. All code in the zip-file: CSVLoad.7z1 point
-
Better way to output ComSpec Local $iPID = Run(@ComSpec & " /c ipconfig /all, @SystemDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) ProcessWaitClose($iPID) Local $sOutput &= StdoutRead($iPID) ; .................................................. If $sOutput = "" or @error or $iPID = 0 Then Consolewrite("error") Else Consolewrite($sOutput) Endif ; ..................................................1 point
-
_ArrayFromString()
Bilgus reacted to argumentum for a topic
@jchd, I am not annoyed, am grateful. I am pushing for this function to be included in the distribution as I find it complementary to other functions. Comments from @BrewManNH and @user4157124 are also welcomed. If y'all don't share your views, I may be going on believing this is kosher but eventually find myself scratching my head. Or worse, someone else, trusting this code, stuff don't work. So as a defacto, prove me wrong. I'll be happy and grateful.1 point -
Silently removing leading zeroes may permanently destroy data, never do that in the general case. Leading zeroes are semantically significant in an unbounded number of situations: James is "007", not "7" and 13-digit barcode "0000870361925" may designate a completely distinct item from "870361925".1 point
-
Delete files Every (n)Seconds
Earthshine reacted to Dwalfware for a topic
I know, sorry, I code like this purposely to make it difficult for other programmers at work . I am so use to it lol0 points