Jump to content

SmOke_N

Moderators
  • Posts

    16,280
  • Joined

  • Days Won

    17

SmOke_N last won the day on April 6

SmOke_N had the most liked content!

3 Followers

About SmOke_N

  • Birthday 03/19/1973

Profile Information

  • Member Title
    It's not what you know ... It's what you can prove!
  • Location
    UNITED STATES

Recent Profile Visitors

5,459 profile views

SmOke_N's Achievements

  1. That's pretty interesting. The regex overhead is the only thing that I can think of for that with a single redim. If I'm being honest, I didn't even see your post before I posted. And was to tired to test yours out once I posted lol. But proofs in the pudding so to speak.
  2. Doing it without concatenation may be faster for larger arrays. Based on what you're showing, you could do a simple for/next loop with a blank ret array or you could put in the bells and whistles to catch some errors like so: #include <Array.au3> Global $array = Get_Array() _ArrayDisplay($array) $array = _StripEmptyElements($array) _ArrayDisplay($array) Func Get_Array() Local $array[7] $array[0] = "12345" $array[1] = "01621" $array[2] = "xyz" $array[3] = "abc@defg.com" $array[4] = " john smith" $array[5] = " sally turner " $array[5] = " " & @CRLF & " " $array[6] = "zxy" Return $array EndFunc ;==>Get_Array ; $bNoWS = White spaces only count as empty element, true by default Func _StripEmptyElements(ByRef $aArgs, $iStart = 0, $bNoWS = True) If UBound($aArgs, 2) Then Return SetError(1, 0, 0) ; out of bounds If $iStart = Default Or $iStart == -1 Then $iStart = 0 If $bNoWS = Default Or $bNoWS == -1 Then $bNoWS = True Local $iUB = UBound($aArgs) ; catch start out of bounds If $iStart < 0 Or $iStart > $iUB - 1 Then Return SetError(2, 0, 0) Local $aRet[$iUB] Local $iEnum = 0 ; build array without concatenation For $i = $iStart To $iUB - 1 If StringLen($aArgs[$i]) == 0 Then ContinueLoop If $bNoWS Then If StringRegExp($aArgs[$i], "(?m)^\s+$") Then ContinueLoop EndIf $aRet[$iEnum] = $aArgs[$i] $iEnum += 1 Next If $iEnum = 0 Then ; nothing found, but rather than return a false ; set error and return array where user can do what they want with it Return SetError(2, 0, $aArgs) EndIf ; resize return array ReDim $aRet[$iEnum] ; return extended as the ubound of new array Return SetExtended($iEnum, $aRet) EndFunc
  3. Damn these eyes.. I seriously didn't see the space!
  4. I'd suggest you actually run that code, there's no $vec[3] so it will certainly crash. As RSN stated, string concatenation is done with an ampersand -> &, we use the + operator only for math. If your strings will look like what you have (eg. "8:00 PM"), then maybe try a regex. Your code: #include <Array.au3> Global $gaArgs = StringSplit("8:00 PM", ":") _ArrayDisplay($gaArgs) Simple approach (keep in mind, the arrays for regular expressions are zero based) #include <Array.au3> Global $gsTime = "8:00 PM" Global $gaArgs = StringRegExp($gsTime, "(.+?)(?:\W|$)", 3) _ArrayDisplay($gaArgs)
  5. That makes me giggle... Whatever the case, I know other mods are already fed up with his ignorantly posturized requests. No matter what people suggest, if they don't write the code for them specifically, this OP is never satisfied to do the work or research. I know others are (including mods) are already at their limit. To the OP, start posting really worked on problems, start researching the suggestions given to you with examples on how those suggestions are not working for you, starting reading some manuals, manuals not only on coding, but maybe how to request help. I'm locking this topic, I know his last topic was locked as well. Hopefully the OP gets the hint.
  6. Yeah, I was closing it out of SciTe when I noticed I had the wrong number of default elements in the return array... oops. You must have went to download it when I was uploading the fix... sorry
  7. I remember when QT widgets came out... those ... lol I have no clue if it'd work, but The first 3 words are "Automate all windows" ... maybe... could be?
  8. Not trying to re-invent the wheel here, but I found some examples that did A-L-O-T that I didn't think was necessary (like forcing owner-drawn), the sparse number of the web examples were failing miserably too. It looked like @argumentum was taking the path I was on, his is much more feature rich ( 😅 ) ... Anyway, I was going to add a font option using this subclass method (Thanks to @LarsJ for his subclass method, saved me some time) but I am out of time and if I don't post this now, I will probably forget to post it later (Yep, age is getting there). @LarsJ - GUIRegisterMsg20 - @argumentum ComboBox Set DROPDOWNLIST Colors/size UDF (Lots-O-Stuff) Here's my short and sweet (I don't think I ever code anything short.. or sweet) Edit 2024-04-10: Added the font change functions, pay attention to the fact that there are 3 different hwnds, the control hwnd, the edit hwnd as well as the listbox hwnd for the combo box. There are 4 functions, one changes all 3, the others change each of the other hwnds. Edit-2 2024-04-10: So I was going to use the forum members meticulous eyes to find issues, but I seemed to find a few that I didn't notice before myself. - Wrong array bounds in font au3 was fixed - Multi color (LB and Edit different colors) fixed (mistakenly used 1 brush ... oops) for color au3 - Missing edit color logic fixed for color au3 GUIComboBox.2024.04.10-002.zip
  9. Yep, you found an issue, If IsArray($aMUpUnique) Then should have been If IsArray($aMatchLower) Then Thanks for finding it, not sure how I did that before I posted ... doh!
  10. Wow, that has the mind racing... What's the wife been doing that we need her photos! Anyway... You should be able to do it a couple of different ways. icloud.com with one of the winhttp udfs on the forum or you should be able to import them with google app/desktop ... of course you'll need the apple id and password. I'd probably use the google desktop option... as I could access the drive directly. Instructions online show: -Sign in with your Apple ID at privacy.apple.com. -Select Request to transfer a copy of your data. -To start the transfer, sign in with your Google Account. -To finish your request, follow the on-screen instructions.
  11. That works on something like: "18/14*4"? 😲
  12. Yep, one of those moments where I forgot that \u or \l doesn't work with our PCRE engine 😞. So I *slap-sticked* some code together to achieve what I needed on the fly. This is truly ugly IMO, but if you're not doing a lot of string manipulation concatenations it's ok. I know I wrote some pcre funcs in a dll back in the day for my personal use to be able to do some things like this, but of course I can't find it... So native it is. Anyway, I added this to my personal chars au3, thus the name you'll see. Please test and criticize away, like I said, it was a quick mod and it's A-L-O-T of regex this and regex that ... but maybe it's useful for someone. #include <StringConstants.au3> #include <Array.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AutChars_RegExpReplaceEx ; Description ...: Allows StringRegExpReplace replace with pattern to do upper/lower ; Syntax ........: _AutChars_RegExpReplaceEx($sData, $sRegEx, $sReplace[, $iCount = 0]) ; Parameters ....: $sData - The string to check ; $sRegEx - The regular expression to compare. See StringRegExp for pattern definition characters. ; $sReplace - The text to replace the regular expression matching text with ; $iCount - Number of replacements. Default is 0 for global replacement ; Return values .: Success - an updated string based on regular expressions ; @extended = number of replacements performed ; Author ........: SmOke_N (Ron Nielsen.. Ron.SMACKThatApp@GMail.com) ; Modified ......: ; Related .......: See StringRegExpReplace() ; Remarks .......: Will only work with \u or \l such as \u$2 in replace with pattern ; In my opinion, this is a pretty abusive way to achieve this, might be fine for small jobs ; but the overhead would be immense ; Example .......: _AutChars_RegExpReplaceEx("abcdAbcefg", "abc", "\u$0") will return ABCdAbcefg ; =============================================================================================================================== Func _AutChars_RegExpReplaceEx($sData, $sRegEx, $sReplace, $iCount = 0) ; work in progress Local Const $iGlobalMatch = $STR_REGEXPARRAYGLOBALMATCH Local $sRet = "" Local Const $sMatchRE = "[\\$](?:u|l)[\$\\]{?\d+\}?" If Not StringRegExp($sReplace, $sMatchRE) Then $sRet = StringRegExpReplace($sData, $sRegEx, $sReplace, $iCount) Return SetError(@error, @extended, $sRet) EndIf ; unique identifier Local $sUStart = "<" & Chr(1) & "@U@" & Chr(1) & ">" Local $sUEnd = "</" & Chr(1) & "@U@" & Chr(1) & ">" Local $sLStart = "<" & Chr(1) & "@L@" & Chr(1) & ">" Local $sLEnd = "</" & Chr(1) & "@L@" & Chr(1) & ">" ; modify replace string Local $sTmp = $sReplace $sTmp = StringRegExpReplace($sTmp, "(?i)([\\$]u)([\$\\]{?\d+\}?)", $sUStart & "$2" & $sUEnd) $sTmp = StringRegExpReplace($sTmp, "(?i)([\\$]l)([\$\\]{?\d+\}?)", $sLStart & "$2" & $sLEnd) Local $sRepStr = StringRegExpReplace($sData, $sRegEx, $sTmp, $iCount) Local $iExtended = @extended ; get upper and lower matches with unique identifier Local $aMatchUpper = StringRegExp($sRepStr, "(\Q" & $sUStart & "\E.*?\Q" & $sUEnd & "\E)", $iGlobalMatch) Local $aMatchLower = StringRegExp($sRepStr, "(\Q" & $sLStart & "\E.*?\Q" & $sLEnd & "\E)", $iGlobalMatch) ; no need to worry about case Local $aMUpUnique, $aMLrUnique If IsArray($aMatchUpper) Then $aMUpUnique = _ArrayUnique($aMatchUpper, 0, 0, 0, $ARRAYUNIQUE_NOCOUNT) EndIf If IsArray($aMatchLower) Then $aMLrUnique = _ArrayUnique($aMatchLower, 0, 0, 0, $ARRAYUNIQUE_NOCOUNT) EndIf $sRet = $sRepStr Local $sMatch For $i = 0 To UBound($aMUpUnique) - 1 $sMatch = StringRegExpReplace($aMUpUnique[$i], "\Q" & $sUStart & "\E|\Q" & $sUEnd & "\E", "") $sRet = StringReplace($sRet, $aMUpUnique[$i], StringUpper($sMatch), $iCount) Next For $i = 0 To UBound($aMLrUnique) - 1 $sMatch = StringRegExpReplace($aMLrUnique[$i], "\Q" & $sLStart & "\E|\Q" & $sLEnd & "\E", "") $sRet = StringReplace($sRet, $aMLrUnique[$i], StringLower($sMatch), $iCount) Next Return SetExtended($iExtended, $sRet) EndFunc
  13. The case statement will continue if the statement is true. 'pic1.png' does not have a false/0 value. It's meant to have a conditional value such as "If $sValue = 'pic1.png' Then", in this case it would be more like "Case sValue = 'pic1.png'", since all your case statements have a relative "True" value, each case will be processed. So, you're using the "Select Case" statements incorrectly. With the way you have your case statement, if you "break" out when it is found, you'll break out every time it reaches "pic1.png" and never reach the other case statements. If you don't care, and this logic makes sense to you for some unknown reason, you can use Return <value> if you're in a function with no loop, or if you're in a loop you can use Continueloop, if you want to keep checking each case statement even if you found the one of the other statements to be true, you do as argumentative has stated and use ContinueCase. If I'm being honest, I don't think I've used a Select statement in AutoIt in 15+ years. To me it's just an If/Then statement with no other benefit.
  14. It failed for me when I clicked the split button, everything else was fine.
×
×
  • Create New...