Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/05/2019 in all areas

  1. @myspacee Global $strString = '[Lunedì 04/03]<30466>[16:50]<30467>[19:15]<R4nd0m>[21:20]' ConsoleWrite("Before: " & $strString & @CRLF & _ "After : " & StringRegExpReplace($strString, '(<[^>]+>)', '') & @CRLF)
    2 points
  2. You can also simply download the pre-built binaries for Windows available on the SQLite page. Well, that's unless you absolutely need a custom build with your own set of options.
    2 points
  3. I just noticed that Outlook does not allow to import iCal events programmatically. I might implement some of the iCalendar data format (RFC 5545) if someone is interested Please post here or click the "Like" button if you think this is a good idea Edit: For download please see my signature
    1 point
  4. I made two folders on my desktop and got this code to work: #include <File.au3> $path = @DesktopDir & "\test\" $path2 = @DesktopDir & "\test2\" $hSearch = FileFindFirstFile($path & "yes*.txt") If $hSearch = -1 Then ConsoleWrite("Oops! No files found..." & @CRLF) FileChangeDir($path) While 1 $filename = FileFindNextFile($hSearch) If @error Then ExitLoop ;no more files If StringLeft($filename, 3) = "yes" Then ConsoleWrite('Moving file "' & $filename & '" to ' & $path & $path2 & '.' & @CRLF) FileMove($filename, $path2) If @error Then ConsoleWrite("Cannot Move File!") EndIf Wend ConsoleWrite("Operation Complete!")
    1 point
  5. Jos

    Need Help in Pointer & Offset

    So you are telling me that you only have 1 account in these forums and you have no idea who member sekaidown is? Maybe he/she was sitting next to you today? Jos
    1 point
  6. With a bit broader range of removal: StringRegExpReplace('F‌inal', '[\x{200B}-\x{200D}]', '') Yet removing ZWJ (U+0200D) may change semantic of Unicode flux in some languages. You may also discover other such special codepoints, depending on the nature of the input text.
    1 point
  7. You could also replace non printable characters: StringRegExpReplace(GuiCtrlRead($sInput), "[^[:print:]]", "")
    1 point
  8. Possibly: StringRegExpReplace('F‌inal', '[\x{200C}\x{200B}]', '')
    1 point
  9. For kicks, This one doesn't need to validate or Incept errors no matter what you throw at it So long as the syntax is correctly put, .. Or if one finds logic to use this otherwise (didn't look too much further..) #include <Date.au3> ; _DateAdd() Like way $Day = 6 $iInstance = 108 $fromDate = True ; will Start counting from the day number else for WeekDay "friday = 6" keep at default = false $Date = _DateDayInMonth_Istance(@YEAR, @MON, $Day, $iInstance, $fromDate) ConsoleWrite(_DateTimeFormat($Date, 1) & @LF) ; Confirm $Format = StringFormat("%04i/%02i/%02i", @YEAR, @MON, $Day) ConsoleWrite(_DateTimeFormat(_DateAdd("w", $iInstance, $Format), 1) & @LF) ; Get first Instance of the WeekDay from the returned year and month $iInstance = 1 $SplitDate = StringSplit($Date, "/") $Day = _DateToDayOfWeek($SplitDate[1], $SplitDate[2], $SplitDate[3]) $Date = _DateDayInMonth_Istance($SplitDate[1], $SplitDate[2], $Day, $iInstance) ConsoleWrite(_DateTimeFormat($Date, 1) & @LF) Func _DateDayInMonth_Istance($iYear = @YEAR, $iMonth = @MON, $iWeekDay = @WDAY, $iInstance = 1, $iStartDay = False) Local $iInst = ($iInstance * 7) - 7 + 1, $iDay If $iStartDay Then $iInst += 6 Else $iWeekDay -= _DateToDayOfWeek($iYear, $iMonth, 1) If $iWeekDay < 0 Then $iWeekDay += 7 EndIf $iDay = $iWeekDay + $iInst While $iDay > _DateDaysInMonth($iYear, $iMonth) $iDay = Abs($iDay - _DateDaysInMonth($iYear, $iMonth)) Switch $iMonth Case 12 $iYear += 1 $iMonth = 1 Case Else $iMonth += 1 EndSwitch WEnd Return StringFormat("%04i/%02i/%02i", $iYear, $iMonth, $iDay) EndFunc Deye
    1 point
  10. Comments added to example in post #1:- #include <MsgBoxConstants.au3> Global $input1 HotKeySet("{ESC}", "End") doit() Func doit() For $i = 5 To 1 Step -1 $nmsg = GUIGetMsg() ; $nmsg = 0, $GUI_EVENT_NONE (0): No event ConsoleWrite("$nmsg: " & $nmsg & " $i: " & $i & @CRLF) Switch $nmsg ; The Switch Case will match when the Case value = 0 Case $i = 5 ; 1st time thru loop $i = 5. So, 5 = 5 = true = 1 $nmsg <> 1 GUICtrlSetData($input1, $i) MsgBox(0, "title", "5") Case $i = 4 ; 1st time thru loop $1 = 5 so 4 = 5 = false = 0 and $nmsg = 0, This case is triggered. GUICtrlSetData($input1, $i) MsgBox(0, "title", "4") Case $i = 3 GUICtrlSetData($input1, $i) MsgBox(0, "title", "3") Case $i = 2 GUICtrlSetData($input1, $i) MsgBox(0, "title", "2") Case $i = 1 GUICtrlSetData($input1, $i) MsgBox(0, "title", "1") EndSwitch Next MsgBox($MB_SYSTEMMODAL, "", "Blast Off!") EndFunc ;==>doit Func End() Exit EndFunc ;==>End Each time through the For-Next loop $nmsg = 0, $GUI_EVENT_NONE (0): No event. So when the Case is 0, the case is triggered in the Switch-EndSwitch function. 1st time thru loop Case $i=5 So, (5 = 5) = True = 1 $nmsg <> 1, Case $i=4 So, (5 = 4) = False = 0 $nmsg = 0 - Matches this Case. 2nd time thru loop Case $i=5 So, (4 = 5) = False = 0 $nmsg = 0 - Matches this Case. In subsequent loops, the 1st case (Case $i=5) is matched because all ($i=5) = False = 0 and the Switch expression, $nmsg, remains at 0. The order of message boxes is:- 4 5 5 5 5 Blast Off! This outcome is logically correct because of the weird coding. You might want to compare the functions "Switch...Case...EndSwitch" and "Select...Case...EndSelect"
    1 point
  11. Local $array = StringRegExp($sHtmlpag, "More information", $STR_REGEXPARRAYGLOBALMATCH) try Local $array = StringRegExp($sHtmlpag, '<a title="More information" href="(.*?)"> WKTL 150 </a>', $STR_REGEXPARRAYGLOBALMATCH)
    1 point
  12. @ces1a, Your function returns invalid date for certain requests, try to ask for the fifth Friday of February 2019 for example ... @Deye, your function will instead return nothing in that case or also if you cross to the next month(s). @FrancescoDiMuro, that function will return the number of the week of the year a date falls into. Is different from what OP intends to achieve. If allowed I would propose my 2 cents, instead of returning an invalid date or nothing at all, my proposed function will return the date where you're going to end up by counting the number of weekdays you specified. So if you ask the 9° sunday of january, the function will count 9 sundays starting from the first one of january and going on up counting 9 of the requested weekday. So is up to you to ask sensate questions, otherwise the function will return however the required date (a valid date anyway) and will just set the error flag if you go beyond the current month Hope it can be of use #include <date.au3> Global Enum $Sunday = 1, $Monday, $Tuesday, $Wednesday, $Thursday, $Friday, $Saturday MsgBox(0, "Demo", _DateGetWeekDay(@YEAR, 2, 5, $Friday) & @CRLF & @CRLF & "@error: " & @error) ; counts next n. weekdays starting from passed year/month and returns target date ; sets @error if required date goes beyond required month Func _DateGetWeekDay($Year = @YEAR, $Month = @MON, $Week = 1, $WeekDay = @WDAY, $DateFormat = 0) Local $iFirstDayOfMonth = _DateToDayOfWeek($Year, $Month, 1) - 1 ; the day of the Week Range is 0 to 6 where 0=Sunday. Local $DaysToSkip = Mod(7 + ($WeekDay - 1 - $iFirstDayOfMonth), 7) + (($Week - 1) * 7) Local $aTargetDate, $aDummyTime _DateTimeSplit(_DateAdd('D', $DaysToSkip, $Year & '/' & $Month & '/01'), $aTargetDate, $aDummyTime) Return SetError($Year <> $aTargetDate[1] Or $Month <> $aTargetDate[2], 0, _DateTimeFormat($aTargetDate[1] & '/' & $aTargetDate[2] & '/' & $aTargetDate[3], $DateFormat)) EndFunc ;==>_DateGetWeekDay
    1 point
  13. Danp2

    Signin Automation Required

    "Not working" isn't sufficient for us to help you solve the issue. You should post the results from the Scite output panel so that we can see where it is failing. P.S. Based on your code, I would suggest taking a look at _IEGetObjByName, _IEFormElementSetValue, and _IEFormSubmit.
    1 point
  14. Nine

    Signin Automation Required

    @Buu85 It will be very hard to help you without the DOM of the 3 objects. Just inspect the 3 objects, capture screen, and post it here.
    1 point
  15. Version 0.3.0.0 of the UDF has been released.
    1 point
  16. iamtheky

    help with regex

    half the ops, but the result has a bonus linefeed at the beginning... Global $STRUCT1 = "Struct;char host[128];char sudo[128];char user[128];char pass[128];char path[256];char cmd[128];int code;EndStruct" MsgBox(0, '' , StringRegExpReplace(StringRegExpReplace($STRUCT1 , "[\[\] ]" , ",") , "(Struct;|,;|;EndStruct)" , @LF))
    1 point
  17. The post count of LandonEvans is 2 and both posts were to advertise this/his tool. Seems he just came here to sell the product
    1 point
  18. Version 1.3.5.0 of the UDF has been released. Please test before using in production! For download please see my signature.
    1 point
  19. Here is another method following the same logic as jchd's example. #include <String.au3> Local $str = _ "WORD_1 : RESULT_1" & @CRLF & _ "ANYLETTER_2 : RESULT_2" & @CRLF & _ "WORDNEXT_3 : RESULT_3" & @CRLF & _ "SOMEWORDMORE_4 : RESULT_4" & @CRLF & _ "ONLY_5 : RESULT_6" Global $max = 0 Execute(StringRegExpReplace($str, "(?m)(\w+)(\h+.+\v*)", '__MaxLen(''$1'')& ') & "''") ; Get maximium number of characters of the first word in all lines. ;ConsoleWrite($max & @CRLF) Local $sFormated = Execute(StringRegExpReplace($str, "(\w+)(\h+:\h+)(\w+\v*)", "'$1'&_StringRepeat(' ', $max - StringLen('$1'))& ' : $3'&") & "''") ConsoleWrite($sFormated & @CRLF) Func __MaxLen($sWord) If StringLen($sWord) > $max Then $max = StringLen($sWord) EndFunc ;==>__MaxLen And, an abbreviation of the above script. ; https://www.autoitscript.com/forum/topic/197984-regexp-replace-insert-whitespace/?do=findComment&comment=1420097 Local $str = _ "WORD_1 : RESULT_1" & @CRLF & _ "ANYLETTER_2 : RESULT_2" & @CRLF & _ " WORDNEXT_3 : RESULT_3 " & @CRLF & _ "SOMEWORDMORE_4 : RESULT_4" & @CRLF & _ "ONLY_5 : RESULT_6" Local $max = 0 ; Get $max, the maximium number of characters of the first word in all lines. Execute(StringRegExpReplace($str, "(\w+).+\v*", '(Stringlen(''$1'')>$max?Assign("max",Stringlen(''$1'')):"")&') & "''") ;ConsoleWrite($max & @CRLF) Local $sFormatted = Execute(StringRegExpReplace($str, "(\w+)\h*:\h*(\w+.*\v*)", 'StringFormat("%-"&$max&"s : %s","$1","$2")&') & "''") ConsoleWrite($sFormatted & @CRLF)
    1 point
  20. mikell

    regexp help

    You might first remove all the "<...>" parts, so the result will be much easier to treat Example $s = '<p data-reactid="202">Appartamento</p></div><div class="features" data-reactid="203"><p data-reactid="204"><!-- react-text: 205 -->€ <!-- /react-text --><!-- react-text: 206 -->79.000<!-- /react-text --><span data-reactid="207"><!-- react-text: 208 -->Tua da <!-- /react-text --><span class="asStrong" data-reactid="209"><!-- react-text: 210 -->€ <!-- /react-text --><!-- react-text: 211 -->261<!-- /react-text --></span><!-- react-text: 212 -->/mese<!-- /react-text --></span></p><ul data-reactid="213"><li data-reactid="214"><!-- react-text: 215 -->55<!-- /react-text --><!-- react-text: 216 --> <!-- /react-text --><span data-reactid="217">mq</span></li><li data-reactid="218">' $r = StringRegExpReplace($s, '<.*?>', "") Msgbox(0,"", $r)
    1 point
  21. Here a simple way that will work ALL the time, but you wont like it tho. : #include <Constants.au3> #include <Array.au3> Opt ("MustDeclareVars", 1) Global Const $FF = '7.1,00000776KN,320639,US,1/5/2019,XXXXXXXXXX,E,,,USD,26694.26,12/20/2018,,XXXXXXXXXXXXX,,4410628,82576404,F/C,1,0,XXXXXXXXXXXXXXXXXX,XXXXXXXX,XXXXXXXXX,,,,0.9,L,1,L,PKG,,,4,SHP,FC,,,,,,,,FRT,3,XXXXXXXX XXXXXX XXXXX,1,,0,,USD,1.29,7.3,,0,0,,0,0,0,0,0,1/16/2019,,,,XXXXXX XXXXXXXXX,"Hu-Frie Mfg. Co., LLC",7 E TOUCHY AVE,,Des Plaines,IL,60018,US,.,"SAPPS,DAVID T., DDS, PC",SAPPS ORTHODONTICS,189 STEWART LANE,JONESBORO,TN,28199,US,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,0,,,,,0,,0,0,,,0,,,,,,,,,,,,0,,,,,,,0,0,0,0,0,0,,,0,0,0,,,,,,2,,,,,,0,0,0,0,0,0,0,,,,,0,,,0,,0,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,XXXXXXXXXXXXXXX' Global Const $rep = " | " Global $arr = StringSplit ($FF,""), $Start = False, $Final = "" For $i = 1 to $arr[0] if $arr[$i] = '"' Then $Start = not $Start if $arr[$i] = ',' and $Start then $arr[$i] = $rep $Final &= $arr[$i] Next Local $test = _ArrayToString ($arr, "", 1) MsgBox ($MB_SYSTEMMODAL,"",$test = $Final) Edit :
    1 point
  22. Add some com object error handling and run it again from within ScITE and if it closes again, it should provide some returned value in the console.
    1 point
  23. You would need something like this to close all open workbooks: #include <Excel.au3> Global $oExcel = _Excel_Open(False) ; Connect to Excel and remain invisible Global $aWorkbooks = _Excel_BookList($oExcel) ; Return a 2D array containing a list of open workbooks For $i = 0 To UBound($aWorkbooks, 1) - 1 ; Close all found workbooks _Excel_BookClose($aWorkbooks[$i][0], False) Next _Excel_Close($oExcel, Default, True) ; Close the Excel instance even when not created by the script
    1 point
  24. Mark the one that you feel confident works and you most understand ...
    1 point
  25. Thanks $string = '"this,is,a,test",3/1/15 11:49:11 AM,COMPUTER01,10.0.0.6,User-defined Rules:test .10,deny read,"\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\Shiller,Ron,09\INSTRUCTION.TXT",,_,10.110.69.16,C:\Program Files\Veritas\NetBackup\bin\bpbkar32.exe,",",' & "'File' class or access,Notice,OAS,My Organization\Servers\Servers\,1092" Do $string = stringregexpreplace($string, '((?:^|,)"[^,"]*),(?=[^"]*")', "$1") Until @extended = 0 msgbox(0, "", $string)
    1 point
  26. The StringRegExp above has a flaw and I'm not sure why, although I'm sure a very good RegExp solution exists. The way I would do this would be to parse the csv to an array, then you can do whatever you like to the data in any cell. There are a few CSV parsing algorithms on the forum, but the one I wrote a while ago still works. If it ain't broke etc... ; Local $sFilePath = @ScriptDir & "\test.csv" ; Change this to your own csv file (in the same directory as the script) Local $hFile = FileOpen($sFilePath) If $hFile = -1 Then MsgBox(0, "", "Unable to open file") Exit EndIf Local $sCSV = FileRead($hFile) If @error Then MsgBox(0, "", "Unable to read file") FileClose($hFile) Exit EndIf FileClose($hFile) Local $aCSV = _CSVSplit($sCSV) ; Create the main array If @error Then ConsoleWrite("Error = " & @error & @LF) Exit EndIf ; Replace all commas in every cell. If Ubound($aCSV, 0) = 2 Then For $i = 0 To UBound($aCSV) -1 For $j = 0 To UBound($aCSV, 2) -1 $aCSV[$i][$j] = StringReplace($aCSV[$i][$j], ",", "") Next Next Else ; CSV only contains one column For $i = 0 To UBound($aCSV) -1 $aCSV[$i] = StringReplace($aCSV[$i], ",", "") Next EndIf Local $sResult = _ArrayToCSV($aCSV, Default, Default, True, True) ConsoleWrite($sResult & @LF) ; For testing on a small sample only. ; WRITE THE RESULT TO FILE HERE! ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArrayToCSV ; Description ...: Converts a two dimensional array to CSV format ; Syntax.........: _ArrayToCSV ( $aArray [, $sDelim [, $sNewLine [, $bFinalBreak [, $bEnclose ]]]] ) ; Parameters ....: $aArray - The array to convert ; $sDelim - Optional - Delimiter set to comma by default (see comments) ; $sNewLine - Optional - New Line set to @LF by default (see comments) ; $bFinalBreak - Set to true in accordance with common practice => CSV Line termination ; $bEnclose - Enclose all fields in double quotes. Default = False ; Return values .: Success - Returns a string in CSV format ; Failure - Sets @error to: ; |@error = 1 - First parameter is not a valid array ; |@error = 2 - Second parameter is not a valid string ; |@error = 3 - Third parameter is not a valid string ; |@error = 4 - 2nd and 3rd parameters must be different characters ; Author ........: czardas ; Comments ......; One dimensional arrays are returned as multiline text (without delimiters) ; ; Some users may need to set the second parameter to semicolon to return the prefered CSV format ; ; To convert to TSV use @TAB for the second parameter ; ; Some users may wish to set the third parameter to @CRLF ; =============================================================================================================================== Func _ArrayToCSV($aArray, $sDelim = Default, $sNewLine = Default, $bFinalBreak = True, $bEnclose = False) If Not IsArray($aArray) Or Ubound($aArray, 0) > 2 Or Ubound($aArray) = 0 Then Return SetError(1, 0 ,"") If $sDelim = Default Then $sDelim = "," If $sDelim = "" Then Return SetError(2, 0 ,"") If $sNewLine = Default Then $sNewLine = @LF If $sNewLine = "" Then Return SetError(3, 0 ,"") If $sDelim = $sNewLine Then Return SetError(4, 0, "") Local $iRows = UBound($aArray), $sString = "" If Ubound($aArray, 0) = 2 Then ; Check if the array has two dimensions Local $iCols = UBound($aArray, 2) For $i = 0 To $iRows -1 For $j = 0 To $iCols -1 If StringRegExp($aArray[$i][$j], '["\r\n' & $sDelim & ']') Or $bEnclose Then $aArray[$i][$j] = '"' & StringReplace($aArray[$i][$j], '"', '""') & '"' EndIf $sString &= $aArray[$i][$j] & $sDelim Next $sString = StringTrimRight($sString, StringLen($sDelim)) & $sNewLine Next Else ; The delimiter is not needed For $i = 0 To $iRows -1 If StringRegExp($aArray[$i], '["\r\n' & $sDelim & ']') Or $bEnclose Then $aArray[$i] = '"' & StringReplace($aArray[$i], '"', '""') & '"' EndIf $sString &= $aArray[$i] & $sNewLine Next EndIf If Not $bFinalBreak Then $sString = StringTrimRight($sString, StringLen($sNewLine)) ; Delete any newline characters added to the end of the string Return $sString EndFunc ;==> _ArrayToCSV ; #FUNCTION# ==================================================================================================================== ; Name...........: _CSVSplit ; Description ...: Converts a string in CSV format to a two dimensional array (see comments) ; Syntax.........: CSVSplit ( $aArray [, $sDelim ] ) ; Parameters ....: $aArray - The array to convert ; $sDelim - Optional - Delimiter set to comma by default (see 2nd comment) ; Return values .: Success - Returns a two dimensional array or a one dimensional array (see 1st comment) ; Failure - Sets @error to: ; |@error = 1 - First parameter is not a valid string ; |@error = 2 - Second parameter is not a valid string ; |@error = 3 - Could not find suitable delimiter replacements ; Author ........: czardas ; Comments ......; Returns a one dimensional array if the input string does not contain the delimiter string ; ; Some CSV formats use semicolon as a delimiter instead of a comma ; ; Set the second parameter to @TAB To convert to TSV ; =============================================================================================================================== Func _CSVSplit($string, $sDelim = ",") ; Parses csv string input and returns a one or two dimensional array If Not IsString($string) Or $string = "" Then Return SetError(1, 0, 0) ; Invalid string If Not IsString($sDelim) Or $sDelim = "" Then Return SetError(2, 0, 0) ; Invalid string $string = StringRegExpReplace($string, "[\r\n]+\z", "") ; [Line Added] Remove training breaks Local $iOverride = 63743, $asDelim[3] ; $asDelim => replacements for comma, new line and double quote For $i = 0 To 2 $asDelim[$i] = __GetSubstitute($string, $iOverride) ; Choose a suitable substitution character If @error Then Return SetError(3, 0, 0) ; String contains too many unsuitable characters Next $iOverride = 0 Local $aArray = StringRegExp($string, '\A[^"]+|("+[^"]+)|"+\z', 3) ; Split string using double quotes delim - largest match $string = "" Local $iBound = UBound($aArray) For $i = 0 To $iBound -1 $iOverride += StringInStr($aArray[$i], '"', 0, -1) ; Increment by the number of adjacent double quotes per element If Mod ($iOverride +2, 2) = 0 Then ; Acts as an on/off switch $aArray[$i] = StringReplace($aArray[$i], $sDelim, $asDelim[0]) ; Replace comma delimeters $aArray[$i] = StringRegExpReplace($aArray[$i], "(\r\n)|[\r\n]", $asDelim[1]) ; Replace new line delimeters EndIf $aArray[$i] = StringReplace($aArray[$i], '""', $asDelim[2]) ; Replace double quote pairs $aArray[$i] = StringReplace($aArray[$i], '"', '') ; Delete enclosing double quotes - not paired $aArray[$i] = StringReplace($aArray[$i], $asDelim[2], '"') ; Reintroduce double quote pairs as single characters $string &= $aArray[$i] ; Rebuild the string, which includes two different delimiters Next $iOverride = 0 $aArray = StringSplit($string, $asDelim[1], 2) ; Split to get rows $iBound = UBound($aArray) Local $aCSV[$iBound][2], $aTemp For $i = 0 To $iBound -1 $aTemp = StringSplit($aArray[$i], $asDelim[0]) ; Split to get row items If Not @error Then If $aTemp[0] > $iOverride Then $iOverride = $aTemp[0] ReDim $aCSV[$iBound][$iOverride] ; Add columns to accomodate more items EndIf EndIf For $j = 1 To $aTemp[0] If StringLen($aTemp[$j]) Then If Not StringRegExp($aTemp[$j], '[^"]') Then ; Field only contains double quotes $aTemp[$j] = StringTrimLeft($aTemp[$j], 1) ; Delete enclosing double quote single char EndIf $aCSV[$i][$j -1] = $aTemp[$j] ; Populate each row EndIf Next Next If $iOverride > 1 Then Return $aCSV ; Multiple Columns Else For $i = 0 To $iBound -1 If StringLen($aArray[$i]) And (Not StringRegExp($aArray[$i], '[^"]')) Then ; Only contains double quotes $aArray[$i] = StringTrimLeft($aArray[$i], 1) ; Delete enclosing double quote single char EndIf Next Return $aArray ; Single column EndIf EndFunc ;==> _CSVSplit ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __GetSubstitute ; Description ...: Searches for a character to be used for substitution, ie one not contained within the input string ; Syntax.........: __GetSubstitute($string, ByRef $iCountdown) ; Parameters ....: $string - The string of characters to avoid ; $iCountdown - The first code point to begin checking ; Return values .: Success - Returns a suitable substitution character not found within the first parameter ; Failure - Sets @error to 1 => No substitution character available ; Author ........: czardas ; Comments ......; This function is connected to the function _CSVSplit and was not intended for general use ; $iCountdown is returned ByRef to avoid selecting the same character on subsequent calls to this function ; Initially $iCountown should be passed with a value = 63743 ; =============================================================================================================================== Func __GetSubstitute($string, ByRef $iCountdown) If $iCountdown < 57344 Then Return SetError(1, 0, "") ; Out of options Local $sTestChar For $i = $iCountdown To 57344 Step -1 $sTestChar = ChrW($i) $iCountdown -= 1 If Not StringInStr($string, $sTestChar) Then Return $sTestChar EndIf Next Return SetError(1, 0, "") ; Out of options EndFunc ;==> __GetSubstitute ; From the following input: test,"\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\Shiller,Ron09\INSTRUCTION.TXT",123 next line,",","\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\Shiller,Ron09\INSTRUCTION.TXT" ; I get (with the option set for all fields to be enclosed): "test","\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\ShillerRon09\INSTRUCTION.TXT","123" "next line","","\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\ShillerRon09\INSTRUCTION.TXT" ; And from the RegExp, I get: test,"\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\ShillerRon09\INSTRUCTION.TXT",123 next line,",","\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\ShillerRon09\INSTRUCTION.TXT" I'm sure it's possible to adapt the RegExp.
    1 point
  27. With StringRegExpReplace : $string = "3/1/15 11:49:11 AM,COMPUTER01,10.0.0.6,User-defined Rules:test .10,deny read,""\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\Shiller,Ron09\INSTRUCTION.TXT"",,_,10.110.69.16,C:\Program Files\Veritas\NetBackup\bin\bpbkar32.exe,'File' class or access,Notice,OAS,My Organization\Servers\Servers\,1092" $replace = StringRegExpReplace($string, '"[^,]+\K,([^"]+")', "$1") ConsoleWrite($replace)
    1 point
  28. $string = '3/1/15 11:49:11 AM,COMPUTER01,10.0.0.6,User-defined Rules:test .10,deny read,"\Device\HarddiskVolumeShadowCopy3455\Applications\APPS\Test\shared\driving\predrivingscreening\AArchive\Shiller,Ron09\INSTRUCTION.TXT",,_,10.110.69.16,C:\Program Files\Veritas\NetBackup\bin\bpbkar32.exe,' & "'File' class or access,Notice,OAS,My Organization\Servers\Servers\,1092" msgbox(0, '' , stringreplace(stringregexp($string , ',"(.*?)",' , 3)[0] , "," , ""))
    1 point
  29. Try to add this call: $EM_SCROLLCARET = 0x00B7 GUICtrlSendMsg($editID, $EM_SCROLLCARET, 0, 0)
    1 point
  30. Do you mean something like: Local $aFileList = _FileListToArrayRec($sRemotePath, "*", 2, 1, 1, 2) _ArrayColInsert($aFileList, 1) For $i = 1 To $aFileList[0][0] $aFileList[$i][1] = StringTrimLeft($aFileList[$i][0], StringInStr($aFileList[$i][0], "\", 0, -1)) Next _ArraySort($aFileList, 1, 1, 0, 1) _ArrayDisplay($aFileList)
    0 points
×
×
  • Create New...