Leaderboard
Popular Content
Showing content with the highest reputation on 02/27/2019 in all areas
-
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.7z2 points
-
New version - 13 Jan 2019 - Added: 2 new functions to hide/show and existing marquee. New UDF and example script in zip format: Marquee.zip As always, ready for compliments and/or complaints! M231 point
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
System restore UDF
obiwanceleri reacted to FredAI for a topic
Hi. I needed this for one of my apps, and all I could find here was a WMI object function to create a restore point, so I decided to create this UDF and post it here. It has functions to enumerate, delete (one or all) and create restore points. Also enable or disable the system restore, and restore the system to one of the restore points. There are only two functions available through DllCall on msdn, the others are WMI. The UDF is not commented yet, I'll do it tomorrow and update. It's getting late, now. Better call it a night. Sorry for the delay. Here's the commented updated version: (28 downloads before) Note: Some functions were slightly modified. Updated 15/11/2011 (66 total downloads). The $DriveL optional parameter in the _SR_Enable and _SR_Disable functions must be in the format $SystemDrive & '\', or the functions won't work. SystemRestore.au31 point -
Delete files Every (n)Seconds
Earthshine reacted to Nine for a topic
@Dwalfware Have you ever heard about indentation ? Because it is really unpleasant to read your code. IMHO.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
-
Yea right, you could have spent the time posting these avoiding posts to open that helpfile and find what you need... it really isn't that hard unless you don't rry. No idea what that really mean. So this is the only help you are going to get until you show some effort: Open the Helpfile:Type Loop in the search box and click search. You will find something like: https://www.autoitscript.com/autoit3/docs/intro/lang_loops.htm Happy coding, Jos1 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
-
Determine the INI File Value in custom Section is empty
Dwalfware reacted to RestrictedUser for a topic
Love you❤️👍1 point -
Determine the INI File Value in custom Section is empty
RestrictedUser reacted to Dwalfware for a topic
You're welcome Good coding1 point -
Try this (tested and working) : Local $oRange = $oWorkbook.activesheet.Range("E2:E20") With $oRange .FormatConditions.Delete ;Delete Existing FormatConditions .FormatConditions.Add($xlCellValue1, $xlBetween1, "1", "10") ;FormatConditions(1) .FormatConditions.Add($xlCellValue1, $xlBetween1, "0", "-10") ;FormatConditions(2) EndWith With $oRange.FormatConditions(1) .Font.Bold = True .Font.Italic = False .Font.ColorIndex = 3 ;Red EndWith With $orange.FormatConditions(2) .Font.Bold = False .Font.Italic = True .Font.ColorIndex = 10 ;Green EndWith1 point
-
1 point
-
Obtain a list of dates from _DateDiff or similar funcs
DrOtosclerosi reacted to Malkey for a topic
Here are two methods to get a descending order set of dates between two dates. #include <Date.au3> #include <Math.au3> Local $sDate1 = "2019/01/02", $sDate2 = "2019/02/04" ; -------------------- Method 1 -------------------------------- Local $aJulDate1 = StringRegExp($sDate1, "(\d{4}).(\d{2}).(\d{2})", 3), $aJulDate2 = StringRegExp($sDate2, "(\d{4}).(\d{2}).(\d{2})", 3) ; <- Arrays Local $iJulDate1 = _DateToDayValue($aJulDate1[0], $aJulDate1[1], $aJulDate1[2]), $iJulDate2 = _DateToDayValue($aJulDate2[0], $aJulDate2[1], $aJulDate2[2]) ; <- Day values Local $Y, $M, $D For $i = _Max($iJulDate1, $iJulDate2) To _Min($iJulDate1, $iJulDate2) Step -1 _DayValueToDate($i, $Y, $M, $D) ConsoleWrite($Y & "/" & $M & "/" & $D & @CRLF) Next ConsoleWrite("==== Or ====" & @CRLF) ; -------------------- Method 2 -------------------------------- Local $iNoOfDays = _DateDiff("D", $sDate1, $sDate2) For $i = Abs($iNoOfDays) To 0 Step -1 ConsoleWrite(_DateAdd("D", $i, ($iNoOfDays < 0 ? $sDate2 : $sDate1)) & @CRLF) Next1 point -
The code above should open all links on the page1 point
-
Obtain a list of dates from _DateDiff or similar funcs
DrOtosclerosi reacted to Subz for a topic
Do you mean something like: Updated to account for -+ days #include <Date.au3> Local $sDate1 = "2019/02/04", $sDate2 = "2019/01/02" Local $iNoOfDays = _DateDiff("D", $sDate1, $sDate2) If $iNoOfDays < 0 Then For $i = $iNoOfDays To 0 ConsoleWrite(_DateAdd("D", $i, $sDate1) & @CRLF) Next Else For $i = 0 To $iNoOfDays ConsoleWrite(_DateAdd("D", $i, $sDate1) & @CRLF) Next EndIf1 point -
Try this: Local $aShift = ["Third", "Fourth", "First", "Second"] Run("C:\util\unilaunch" & $aShift[Mod(@HOUR, 6)] & "Shift.exe")1 point
-
Because you are mixing numbers with strings. Read carefully help file : @HOUR vary from "00" to "23". "0", "5","6" are invalid in that context. Now your homework is to find the right value for those three.1 point
-
when you point in here _IECreate("http://repl.flexlink.com/os/products.htm?clicktype=A") return web page The session is invalid or has expired, please login again. Redirecting to login page in 10 seconds... My FlexLink you must automate a login first , and after navigate , in this link $oIE1 = _IENavigate("http://repl.flexlink.com/os/products.htm?clicktype=A") _IELoadWait($oIE1, 1, 1) not use send study the udf _IE , you find in help F11 point
-
Determine the INI File Value in custom Section is empty
RestrictedUser reacted to Dwalfware for a topic
You should just add "Boy" to the iniread so if they key is not there it always defaults to the key Global $iniset1 = IniRead(@ScriptDir & "\settings.ini", "options", "Somekey", "") like this Global $iniset1 = IniRead(@ScriptDir & "\settings.ini", "options", "Somekey", "boy") I added the if not fileexists what created the file is the user deleted it1 point -
Determine the INI File Value in custom Section is empty
RestrictedUser reacted to Dwalfware for a topic
Something like this ;If not FileExists(@ScriptDir & "\settings.ini") Then IniWrite(@ScriptDir & "\settings.ini", "options", "Somekey", "") ;Endif Global $iniset1 = IniRead(@ScriptDir & "\settings.ini", "options", "Somekey", "") consolewrite("Hello Computer " & $iniset1 & @CRLF) If $iniset1 = "" then IniWrite(@ScriptDir & "\settings.ini", "options", "Somekey", "Boy") Endif Global $iniset2 = IniRead(@ScriptDir & "\settings.ini", "options", "Somekey", "Boy") consolewrite("Hello Computer " & $iniset2 & @CRLF)1 point -
I just modified your UDF, a little No breaking Changes (I hope). SystemRestore.au31 point
-
Multiple File Selection > Output Individual
GoogleGonnaSaveUs reacted to iceberg for a topic
Got It, Melba! thanks for the lead. cheers! Local $out = StringSplit($sFileOpenDialog, "|") For $i = 2 To $out[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", $out[1] & "\" & $out[$i]) Next1 point -
Block input to GUICtrlCreateEdit()
gonzo070777 reacted to taq for a topic
I've been searching these forums for literally hours and I couldn't find a solution for this. And then a light bulb just turned on inside my head: #include <GUIConstants.au3> HotKeySet("^{end}","_Exit") GUICreate("Blocked Editbox",200,110) GUICtrlCreateLabel("Press Ctrl+End to exit",45,5) $edit = GUICtrlCreateEdit("",10,20,180,80,$ES_AUTOVSCROLL+$WS_VSCROLL) $cover = GUICtrlCreateLabel("",10,20,162,80) ; blocking the edit box! GUICtrlSetState($cover,$GUI_ONTOP+$GUI_FOCUS) GUISetState() Dim $line While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect $line = $line + 123456 ;just an example of the text scrolling GUICtrlSetData($edit, $line & @CRLF, 1) Sleep(500) WEnd Func _Exit() Exit EndfuncSo basically I just put a transparent label on top of the edit box, so now it's not possible to click it. I feel pretty clever ;o1 point -
Forum is full of examples and UDFs of how to use DllCall, using Windows API too. Anyway, here you go... $file = "FileInUseTestfile.txt" $h = FileOpen($file, 1) $x = _FileInUse($file) MsgBox(0, "_FileInUse() example", "File "& $file & @CRLF & "Return= " & $x & " (Error = " & @error & ")") FileClose($h) $x = _FileInUse($file) MsgBox(0, "_FileInUse() example", "File "& $file & @CRLF & "Return= " & $x & " (Error = " & @error & ")") FileDelete($file) ;=============================================================================== ; ; Function Name: _FileInUse() ; Description: Checks if file is in use ; Parameter(s): $sFilename = File name ; Return Value(s): 1 - file in use (@error contains system error code) ; 0 - file not in use ; ;=============================================================================== Func _FileInUse($sFilename) Local $aRet, $hFile $aRet = DllCall("Kernel32.dll", "hwnd", "CreateFile", _ "str", $sFilename, _ ;lpFileName "dword", 0x80000000, _ ;dwDesiredAccess = GENERIC_READ "dword", 0, _ ;dwShareMode = DO NOT SHARE "dword", 0, _ ;lpSecurityAttributes = NULL "dword", 3, _ ;dwCreationDisposition = OPEN_EXISTING "dword", 128, _ ;dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL "hwnd", 0) ;hTemplateFile = NULL $hFile = $aRet[0] If $hFile = -1 Then ;INVALID_HANDLE_VALUE = -1 $aRet = DllCall("Kernel32.dll", "int", "GetLastError") SetError($aRet[0]) Return 1 Else ;close file handle DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Return 0 EndIf EndFunc1 point