Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/25/2020 in all areas

  1. I am sure you can make an AutoIt for Linux. you have quite a bit of work to do with just writing a compiler/interpreter I see you laughing at me, see? no respect... LOL 🙂 @Dana86, I am a big believer in using the proper tools for the job. Whatever is most useful.
    2 points
  2. I tell ppl. I use C++ and add a Boralnd C++ icon. Most ppl have no clue and "C++" sounds like they are smart and are making a good choice using me ...if they wanna dig deeper, I tell'em is a C++ stub I've got, and that speeds my development. Not much is a lie. Then again, I don't fight with egos.
    2 points
  3. Exit fixed it and all works perfect now thank you Exit you so much you are a super man.
    1 point
  4. Indeed, that is one of the reasons why I am struggling to find the time for it, a lot of research involved. I was laughing at the part mentioning the college kids There are advantages in both approaches. For my project I am planning to do a hybrid approach, where the plain text script will compile to a processed binary file, so that the actual interperter doesn't have to deal with parsing strings. Python uses a similar approach I think.
    1 point
  5. hmm, I'd go like interpreted code rather than machine-code compile. To future proof the code across the immensity of Linux flavors. ( my view tho, would not mind machine code )
    1 point
  6. Technically (sic) you are no doubt right. But I guess it meets the requirement of two out of the three words - AutoIt Discussion.
    1 point
  7. Assuming that all the lines begin with 4 digits followed by a pipe, this should work $txt = FileRead("test.csv") $txt = StringRegExpReplace($txt, '\R+(?!\d{4}\|)', " ") Msgbox(0,"", $txt)
    1 point
  8. Have you tried _FileReadToArray? You can then add the array directly into Excel, using the _Excel functions. Here is a basic example: Create a spreadsheet CsvData.xlsx in the root path of the script Create two subfolders Inbox and Outbox Add your csv files to be processed to Inbox folder Run the script Processed csv files are moved to Outbox folder #include <Array.au3> #include <Excel.au3> #include <File.au3> _GetCsvData() Func _GetCsvData() Local $aCsvData[0][0], $iColumns = 0 ;~ XLSX Spreadsheet to hold CSV Data Local $sCsvData = @ScriptDir & "\CsvData.xlsx" ;~ Process files here Local $sInbox = @ScriptDir & "\Inbox" ;~ Move processed files here Local $sOutbox = @ScriptDir & "\Outbox" Local $aInbox = _FileListToArrayRec($sInbox, "*.csv", 1, 0, 0, 2) If @error Then Return SetError(1) Local $aFileData, $aFileLine For $i = 1 To $aInbox[0] _FileReadToArray($aInbox[$i], $aFileData) If @error Then ContinueLoop For $j = 1 To $aFileData[0] $aFileLine = StringSplit($aFileData[$j], "|", 2) If @error Then ContinueLoop If StringLen($aFileLine[0]) = 4 And StringIsDigit(($aFileLine[0]) Then If UBound($aFileLine) > $iColumns Then ReDim $aCsvData[UBound($aCsvData)][UBound($aFileLine)] _ArrayTranspose($aFileLine) _ArrayAdd($aCsvData, $aFileLine) EndIf Next FileMove($aInbox[$i], StringReplace($aInbox[$i], $sInbox, $sOutbox), 9) Next Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(4096, "Excel Error", "Error Opening Excel") Local $oWorkbook = _Excel_BookOpen($oExcel, $sCsvData) If @error Then _Excel_Close($oExcel) MsgBox(4096, "Excel Error", "Error Opening Excel Workbook : " & @CRLF & $sCsvData) Exit EndIf Local $iLastRow = $oWorkbook.ActiveSheet.UsedRange.Rows.Count _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $aCsvData, "A" & $iLastRow) _Excel_BookClose($oWorkbook) _Excel_Close($oExcel) EndFunc Updated: IsNumber(Number($aFileLine[0])) with StringIsDigit(($aFileLine[0]) Thanks Nine
    1 point
  9. The beauty of free software is that anyone can use and share it, and it enables many people to expand their horizons with almost zero investment (not counting time, of course). Like @TheSaint has said, it enables people. Enables them to take true control of their computer! There are many ways to monitize free sofware, one way is to run ads on the forum (this forum runs ads for unregistered users). And donations are of course part of the picture, with enough users a developer can sustain himself to work on the project based on their donations. I know a few people who have managed to accomplish this. I miss AutoIt ever since I switched to Linux, where I mainly program JavaScript as part of my job. Though I hope to change the situation one day with my project, I am thinking about starting work on it soon.
    1 point
  10. A new version (v1.3.0) was just published to the Downloads section of the forum. Added _CryptoNG_GenerateRandom and supporting internal function. Added an example of how to implement the new function to the examples file.
    1 point
  11. First of all : "There is nothing wrong with the work-around suggested by @Chimp !" The question that pops into my mind (and Chimp's mind certainly as well) is : Which program or process generates this loginfo.ini ? Is it possible, that you (or someone in your environment) create this file and only use the ini-format because you know it best ? I find it hard to imagine, that a professional software would create such a malformed .ini. We may be able to offer a better solution, if we know the genesis of this file .
    1 point
  12. @Dana86, well, you are just considering python vs autoit on Windows. Python runs on everything so you can do cross-platform development and testing with it. still, they are both nice scripting languages that I find highly useful. As for respect, punks out of college usually think they are hot to trot, so you can probably forget about respect these days. my kid is 20 now and still thinks he knows everything--despite the fact that I have way more experiences and education from which to draw on--so just consider the source I guess. lol
    1 point
  13. as already pointed out by Musashi, your ini file is misconfigured: It doesn't include the key=value pairs and it also has a "variable" number of "columns" on random records. For first problem you can use as a workaround the insertion of the "=" sign as the last character of the string in the ini file while for the mismatch of columns you have to solve by ensure that each "row" in the ini file is correctly formatted here the Loginfo.ini file with the "=" workaround [20200103] 100.162.160.11|PCF-CG0006R8|memn.gnslpsMicrosoft Windows 10 Enterprise 2016 LTSB|14393|A0-1073741824-667|A1-1073741824-667||3.01.2020 19:37:30= 100.162.160.11|PCF-CG0006R8|ssmt.krkrnMicrosoft Windows 10 Enterprise 2016 LTSB|14393|A0-1073741824-667|A1-1073741824-667||3.01.2020 19:36:49= 100.162.160.77|PCT-CG0006S1|sysm.drums|Microsoft Windows 10 Enterprise 2016 LTSB|14393|ChannelA-DIMM0-4294967296-2400|ChannelB-DIMM0-4294967296-2400||03.01.2020 16:50:36= [20200104] 100.162.160.73|PCX-CG0006M5|Administrato|Microsoft Windows 10 Enterprise|14393|XMM3-2147483648-1333|XMM4-2147483648-1333|SYSTEM ROM-1048576-||3.01.2020 16:16:27= 100.162.160.73|PCX-CG0006M5|rtgrl.krks|Microsoft Windows 10 Enterprise|14393|XMM3-2147483648-1333|XMM4-2147483648-1333|SYSTEM ROM-1048576-||3.01.2020 16:15:58= [20200105] 100.162.160.44|PCT-F4480Y6P|fkrt.ytmurk|Microsoft Windows 10 Enterprise 2016 LTSB|14393|ChannelA-DIMM0-8589934592-2400||03.01.2020 15:31:32= while for the mismatch of columns, istead of trying to auto-match data with columns, I think that ensure that each "row" in the ini file is correctly formatted should be a better choice. The following modified version of your script will show you the wrong "records" #include <Array.au3> #include <GUIConstants.au3> $gui = GUICreate("ListBiew items", 1000, 300, -1, -1, -1, $WS_EX_ACCEPTFILES) $listview = GUICtrlCreateListView("DATE|IP|PC NAME|USER NAME|OS TYPE|OS VER|DIMM 1|DIMM 2|DATE-TIME", 10, 10, 380, 280) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() ;$File = FileOpenDialog("Select INI file", "", "(*.ini)") $File = @ScriptDir & "\Loginfo.ini" $Sect = IniReadSectionNames($File) For $i = 1 To $Sect[0] $list = IniReadSection($File, $Sect[$i]) For $x = 1 To $list[0][0] ; check for columns mismatch errors StringReplace($list[$x][0], '|', '|') $iSeparators = @extended If $iSeparators > 8 Then GUICtrlCreateListViewItem("Columns Mismatch error.", $listview) Else GUICtrlCreateListViewItem($list[$x][0], $listview) ; $Sect[$i] & "|" & $tmp, $listview) EndIf Next Next GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, 100) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE
    1 point
  14. @Jos @RTFC @jchd @argumentum @Nine @TheSaint @LarsJ @condoman Thanks everyone for help. After a few days of tests where I used many different options i decided to stay with Dictionary. Edited main thread with solution for ppls with this same problem. Below speed results for using 3 methods to find user nr 100,000 where his table was {name, passwd, range, group}. [ADODB.Connection]: 8ms real-time save/write to file [_SQLite_]: 21ms real-time save/write to file [Dictionary+XML]: 0.06ms memory edit, to save file need spent additional 2s.
    1 point
  15. Just for the record, yes I am getting older .... all the time in fact. Not sure you can apply fat and lazy to me though, just because I prefer to usually give my coding help in other ways ... something I have always done ... prior to becoming MVP too. Take all the programs and scripts I regularly provide here or update, all for free ... no one makes me do it, and hardly something a lazy person would bother with. Here is a slightly related one to this topic ... there are others. And here is a doorway to many more, if mostly unrelated. And I have provided many many more. On behalf of all good fat people everywhere, I take offense. @Jos - Don't worry, this is not the start of an ongoing conversation, just illumination for those who need it. I will now leave this topic in peace.
    1 point
  16. Round may not be the thing you want it should be Floor or Int functions. As for the remainder you could use Mod function.
    1 point
  17. Wouldn't it be something like: Func _Calculate() $iOrgNum = GUICtrlRead($Input1) $iDivNum = Floor($iOrgNum/50) MsgBox(4096, "", "50 Count = " & $iDivNum & @CRLF & "Difference: " & Mod($iOrgNum, 50)) EndFunc * Updated to use Floor and Mod
    1 point
  18. Did you wet your bed or something to trigger this unneeded response? Maybe next time just take a cold shower to clean/cool off and refrain from posting here is a better option? Jos
    1 point
  19. This is also a very convenient opinion if you are too fat, old, lazy or simply don't have the necessary coding skills. The active supporters today are a bunch of chit-chatting guys and not really coders. It would be desirable if we could get some more coders and a little less chit-chatting guys.
    1 point
  20. Most of the time it is just ignorant snobbery .... like if you don't wear the right trendy shoes or clothes. I always smile and know I know a great empowering secret they don't ... not forgetting it is about the right tool for the right job. I can never get past how much AutoIt has enabled me, with the least amount of trouble compared to other languages. Quite frankly, I feel blessed. Thanks Jon and Team.
    1 point
  21. My thanks to the guys on my forum topic "Enhancement to string TRIM functions" who provided the inspiration (and a lot of the code) for four new string TRIM() functions: _LTRIM() _RTRIM(), _ALLTRIM() and _TRIM(). These functions trim unwanted characters from the left, right or both ends of a character string. The default characters trimmed are spaces but more than one contiguous character can be trimmed it once. For example back slashes and spaces my be trimmed together. The functions that achieve this result are included in the attached file along with installation instructions, reproduced below. ================================================================== Purpose: Implements new functions _RTRIM(), _LTRIM(), _ALLTRIM(), _TRIM() To implement functions equivalent to the old dBase functions that removed spaces from the, respectively, right, left and both left and right of a character string. The function _TRIM() is equivalent to _RTRIM() and is provided for consistency with the old dBase standard. These four functions remove contiguous characters from the left and/or right of a character string but not those that are within the string. For example _RTRIM("Mary had a little lamb ") will become "Mary had a little lamb" - the spaces inside the string are not removed. Syntax: ResultString = <FunctionName>( string1, string2 ) <FunctionName> as above: _RTRIM(), _LTRIM(), _ALLTRIM(), _TRIM() string1 is the character string to examine. string2 is a list of the characters to be examined for; if omitted it defaults to the standard space character, chr(32). ResultString is the string returned by the function with all characters in string2 trimmed from the left and/or right of string1. If string2 = "%%whs%%" all white space characters will be trimmed from string1. Whitespace includes Chr(9) thru Chr(13) which are HorizontalTab, LineFeed, VerticalTab, FormFeed, and arriageReturn. Whitespace also includes the standard space character. ResultString will be shorter than string1 by an amount equal to the number of characters trimmed from string1. These functions are not case sensitive, e.g. "m" in string2 will trim both "M" and "m" from string1. On any error condition ResultString will be equal to string1. Examples: _RTRIM("Mary had a little lamb ") -> "Mary had a little lamb" _RTRIM("Mary had a little giraffe xyxyxyz", "xyz") -> "Mary had a little giraffe " (note space at end has not been removed). _RTRIM("Mary had a little giraffe xyxyxyz", " xyz") -> "Mary had a little giraffe" (now the same space has been removed because a space is now included in string2). _RTRIM("Mary had a little giraffe xyxbyxyz", "xyz") -> "Mary had a little giraffe xyxb" (only the x, y and z following the "b" will be removed because the "b" is not in string2. To use: 1. Copy this script to the "Include" folder under the AutoIt programs folder. (for example: c:\program files\autoit3\include\myfunctions.au3 ) 2. In your Autoit3 script have following statement: #include <myfunctions.au3> 3. "myfunctions" can be renamed to anything you want. Disclaimer: Thoroughly tested and debugged, but use entirely at your own risk. Usage automatically acknowledges acceptance of this condition. MyFunctions.zip
    1 point
×
×
  • Create New...