Jump to content

SmOke_N

Moderators
  • Posts

    16,280
  • Joined

  • Days Won

    17

Everything posted by SmOke_N

  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.
  15. AutoIt3.exe ended.rc:-1073740771 Same error, I'm gonna take a nap before I look...
  16. wpa+tkip or wpa2+tkip does give authentication of WPA/WPA2 Enterprise
  17. You can't directly connect to your wifi through the command prompt (eg. netsh), however there's always some work around. I've never worked with NETSH before, but I played around for a while with it. I'll be honest, I've never been a fan of using the command prompts of apps, for some reason I feel like I have less control. These are make-shift udfs I just put together, some were my practice funcs, but if you look at the ones I point out at the top, they may help you. The last one, if the first two function calls fail, is one where you can create a tmp xml file, add that profile, run the netsh command then delete the tmp xml file. All of these worked on the my Windows 10 machine. Should work on Windows 11 too from what I was reading. ;~ #RequireAdmin ; may need to have admin priviliges #include-once #include <AutoItConstants.au3> #include <StringConstants.au3> #include <FileConstants.au3> Global $gsMySSID_WifiName = "MyNetwork" ; obviously change it to your own network name If Not _AutNETSH_WLan_IsConnectedBy("SSID", $gsMySSID_WifiName) Then ConsoleWrite("Going to attempt to connect.." & @CRLF) _AutNETSH_WLan_ConnectionRequest($gsMySSID_WifiName) Sleep(5000) ; give it 5 seconds and check if it worked If Not _AutNETSH_WLan_IsConnectedBy("SSID", $gsMySSID_WifiName) Then ConsoleWrite("Still not connected, does the profile exist yet?" & @CRLF & _ "If the profile doesn't exist, or the password/username changes often, try using: " & @CRLF & _ "_AutNETSH_WLan_AddConnectionRequest() below somwwhere..." & @CRLF) EndIf EndIf Func _AutNETSH_WLan_IsConnectedBy($sType, $sFind, $sWkDir = Default) ; because @error may return error text ; we'll just return yes or no string If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show interface", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf ; escape type and value to find $sType = __AutNETSH_WLan_EscapeDelimiters($sType) $sFind = __AutNETSH_WLan_EscapeDelimiters($sFind) Local $sStRE = "(*UCP)(?mi)\h*" & $sType & "\h*\:\h*" & $sFind & "\h*$" Return (StringRegExp($aRead[0], $sStRE) <> 0) EndFunc Func _AutNETSH_WLan_IsConnected($sWkDir = Default) ; because @error may return error text ; we'll just return yes or no string If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show interface", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sStRE = "(*UCP)(?mi)\h*state\h*\:\h*(\w+)" Local $aRet = StringRegExp($aRead[0], $sStRE, $STR_REGEXPARRAYGLOBALMATCH) If Not IsArray($aRet) Then Return SetError(2, 0, "") EndIf Return $aRet[0] EndFunc Func _AutNETSH_WLan_ConnectionRequest($sSSID, $sWkDir = Default) If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf ; connect to profile Local $iPID = Run('netsh wlan connect name="' & $sSSID & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Return $aRead[0] EndFunc Func _AutNETSH_WLan_AddConnectionRequest($sSSID, $sPassword, $sConnectionType = Default, _ $sConnectionMode = Default, $sAuthentication = Default, _ $sEncryption = Default, $sUseOneX = Default, $sKeyType = Default, _ $sProtected = Default, $sEnableRandomization = Default, _ $sWkDir = Default, $sTmpPath = Default) If $sConnectionType = Default Or $sConnectionType = -1 Then $sConnectionType = "ESS" EndIf If $sConnectionMode = Default Or $sConnectionMode = -1 Then $sConnectionMode = "auto" EndIf If $sAuthentication = Default Or $sAuthentication = -1 Then $sAuthentication = "WPA2PSK" EndIf If $sEncryption = Default Or $sEncryption = -1 Then $sEncryption = "AES" EndIf If $sUseOneX = Default Or $sUseOneX = -1 Then $sUseOneX = "false" EndIf If $sKeyType = Default Or $sKeyType = -1 Then $sKeyType = "passPhrase" EndIf If $sProtected = Default Or $sProtected = -1 Then $sProtected = "false" EndIf If $sEnableRandomization = Default Or $sEnableRandomization = -1 Then $sEnableRandomization = "false" EndIf If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf If $sTmpPath = Default Or $sTmpPath = -1 Or Not FileExists($sTmpPath) Then $sTmpPath = @ScriptDir EndIf Local $sXMLFile = "WLAN." & StringRegExpReplace($sSSID, "(*UCP)\W", "") $sXMLFile &= ".tmp(" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC & ").xml" Local $sOutXML = StringRegExpReplace($sTmpPath, "[\\/]+$", "") & "\" & $sXMLFile Local $sXML = "" $sXML &= '<?xml version="1.0"?>' & @CRLF $sXML &= ' <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">' & @CRLF $sXML &= ' <name>' & $sSSID & '</name>' & @CRLF $sXML &= ' <SSIDConfig>' & @CRLF $sXML &= ' <SSID>' & @CRLF $sXML &= ' <name>' & $sSSID & '</name>' & @CRLF $sXML &= ' </SSID>' & @CRLF $sXML &= ' </SSIDConfig>' & @CRLF $sXML &= ' <connectionType>' & $sConnectionType & '</connectionType>' & @CRLF $sXML &= ' <connectionMode>' & $sConnectionMode & '</connectionMode>' & @CRLF $sXML &= ' <MSM>' & @CRLF $sXML &= ' <security>' & @CRLF $sXML &= ' <authEncryption>' & @CRLF $sXML &= ' <authentication>' & $sAuthentication & '</authentication>' & @CRLF $sXML &= ' <encryption>' $sEncryption & '</encryption>' & @CRLF $sXML &= ' <useOneX>' & $sUseOneX & '</useOneX>' & @CRLF $sXML &= ' </authEncryption>' & @CRLF $sXML &= ' <sharedKey>' & @CRLF $sXML &= ' <keyType>' & $sKeyType & '</keyType>' & @CRLF $sXML &= ' <protected>' & $sProtected & '</protected>' & @CRLF $sXML &= ' <keyMaterial>' & $sPassword & '</keyMaterial>' & @CRLF $sXML &= ' </sharedKey>' & @CRLF $sXML &= ' </security>' & @CRLF $sXML &= ' </MSM>' & @CRLF $sXML &= ' <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">' & @CRLF $sXML &= ' <enableRandomization>' & $sEnableRandomization & '</enableRandomization>' & @CRLF $sXML &= ' </MacRandomization>' & @CRLF $sXML &= '</WLANProfile>' Local $hOpen = FileOpen($sOutXML, $FO_OVERWRITE) FileWrite($hOpen, $sXML) FileClose($hOpen) ; add profile to cache Local $iPID = Run('netsh wlan add profile filename="' & $sOutXML & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then FileDelete($sOutXML) Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local $sRet = $aRead[0] ; connect to profile $iPID = Run('netsh wlan connect name="' & $sSSID & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then FileDelete($sOutXML) Return SetError(2, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf FileDelete($sOutXML) $sRet &= " : " & $aRead[0] Return $sRet EndFunc Func _AutNETSH_WLan_ShowNetworks($sWkDir = Default) ; return network array If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show networks", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Or Not IsArray($aRead) Then Return SetError(1, @error, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sSSIDRE = "(?si)(SSID\h*\d+\h*\:\h*.+?)(?:\v{3,}|$)" Local $aSSIDs = StringRegExp($aRead[0], $sSSIDRE, $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aSSIDs) Then Return SetError(2, @error, "") EndIf Local $aHeaders = __AutNETSH_WLan_stdoutgetheader($aSSIDs) If @error Then Return SetError(3, @error, "") EndIf Local $aHData = __AutNETSH_WLan_stdoutgethdata($aSSIDs, $aHeaders) If @error Then Return SetError(4, @error, "") EndIf Return $aHData EndFunc ; See RunAs() in help file, may need to sign on as admin acct Func _AutNETSH_WLan_ShowNetworksAsUser($sUserName, $sDomain, $sPassword, $sLogonFlag, $sWkDir = Default) ; return network array If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = RunAs($sUserName, $sDomain, $sPassword, $sLogonFlag, _ "netsh wlan show networks", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Or Not IsArray($aRead) Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sSSIDRE = "(?si)(SSID\h*\d+\h*\:\h*.+?)(?:\v{3,}|$)" Local $aSSIDs = StringRegExp($aRead[0], $sSSIDRE, $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aSSIDs) Then Return SetError(2, @error, "") EndIf Local $aHeaders = __AutNETSH_WLan_stdoutgetheader($aSSIDs) If @error Then Return SetError(3, @error, "") EndIf Local $aHData = __AutNETSH_WLan_stdoutgethdata($aSSIDs, $aHeaders) If @error Then Return SetError(4, @error, "") EndIf Return $aHData EndFunc Func _AutNETSH_WLan_STDRead($iPID) $iPID = ProcessExists($iPID) If Not $iPID Then Return SetError(1, 0, 0) EndIf Local $sTmp, $sORead, $sOErr While ProcessExists($iPID) $sTmp = StdoutRead($iPID) If @error Then $sOErr = StderrRead($iPID) ExitLoop EndIf $sORead &= $sTmp WEnd ; clean up leading and traling $sORead = StringRegExpReplace($sORead, "(?s)^\s*|\s*$", "") $sOErr = StringRegExpReplace($sOErr, "(?s)^\s*|\s*$", "") Local $aRet[2] = [$sORead, $sOErr] If StringLen($sORead) = 0 Then Return SetError(1, 0, $aRet) EndIf Return $aRet EndFunc Func __AutNETSH_WLan_stdoutgetheader(ByRef $aData) If Not IsArray($aData) Then Return SetError(1, 0, 0) EndIf ; how many heades, some will have more/less based on connection type Local $iExt, $iHeaderCount = 0, $aHeaders For $i = 0 To UBound($aData) - 1 StringRegExpReplace($aData[$i], "(?m)\h+\:", "") $iExt = @extended If $iExt > $iHeaderCount Then $iHeaderCount = $iExt $aHeaders = StringRegExp($aData[$i], "(?m)\h*(.+?)\h+\:", $STR_REGEXPARRAYGLOBALMATCH) If IsArray($aHeaders) Then For $j = 0 To UBound($aHeaders) - 1 If StringInStr($aHeaders[$j], "SSID") Then $aHeaders[$j] = "SSID" ExitLoop EndIf Next EndIf EndIf Next If $iHeaderCount = 0 Then Return SetError(2, 0, 0) EndIf Return SetExtended($iHeaderCount, $aHeaders) EndFunc Func __AutNETSH_WLan_stdoutgethdata(ByRef $aData, ByRef $aHeaders) If Not IsArray($aData) Then Return SetError(1, 0, 0) EndIf If Not IsArray($aHeaders) Then Return SetError(2, 0, 0) EndIf ; [0][n] = headers Local $aRet[UBound($aData) + 1][UBound($aHeaders)] ; fill headers into ret array For $i = 0 To UBound($aHeaders) - 1 $aRet[0][$i] = $aHeaders[$i] ; turn headers into escaped chars $aHeaders[$i] = __AutNETSH_WLan_EscapeDelimiters($aHeaders[$i]) Next Local $aFound, $aLines, $iEnum, $iColCount = 0 ; start at 1, 0 is headers For $i = 0 To UBound($aData) - 1 $iEnum = 0 ; split into individual rows $aLines = StringRegExp($aData[$i], "\h*(.+?)\h*(\v+|$)", $STR_REGEXPARRAYGLOBALMATCH) For $x = 0 To UBound($aLines) - 1 For $j = 0 To UBound($aHeaders) - 1 If StringRegExp($aLines[$x], "(?i)^\h*" & $aHeaders[$j]) Then $aFound = StringRegExp($aLines[$x], "(?mi)\h*" & $aHeaders[$j] & ".*?\:\h*(.+?)\h*$", $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aFound) Then ContinueLoop $aRet[$i + 1][$j] = $aFound[0] $iEnum += 1 ExitLoop EndIf Next Next If $iEnum > 0 Then $iColCount += 1 Next If $iColCount < UBound($aData) Then ; oops EndIf Return $aRet EndFunc Func __AutNETSH_WLan_EscapeDelimiters($sData) Local Const $sRE = "([\\\.\^\$\|\[|\]\(\)\{\}\*\+\?\#])" Local Const $sRep = "\\$1" Return StringRegExpReplace($sData, $sRE, $sRep) EndFunc If you're going to do this across a private network, you may want to look into RunAs(), I have one example function in there with that that you can kind of get the idea from. Anyway, I did more than I thought I would for something I can never see myself using... so hope it helps. Edit: You may need to change this section for enterprise: $sXML &= ' <authEncryption>' & @CRLF $sXML &= ' <authentication>WPA2PSK</authentication>' & @CRLF $sXML &= ' <encryption>AES</encryption>' & @CRLF $sXML &= ' <useOneX>false</useOneX>' & @CRLF $sXML &= ' </authEncryption>' & @CRLF I'm to lazy to make something that does it atm. Edit2: Changed _AutNETSH_WLan_AddConnectionRequest() so you can customize all the xml options if needed. I'm not 100% on WPA2 Enterprise, but it looks like you can change Authentication = WPA2 and Encryption to TKIP... anyway, really really really done this time
  18. Hmm... [\\\^] will only look for back slash and "to the power of" ^ ... both codes I provided in my last post are correct (for all my different testing), but the operator regex is [\*/^]
  19. So... Like I said, I didn't extensively test it... It makes sense looking at the regular expression pattern that the 20*360 was encased by parenthesis. Func _ExecuteNums($vData) Local Const $sRE = "(\d+\h*[\*/^]\h*\d+)" Return Execute(StringRegExpReplace($vData, $sRE, "\($1\)")) EndFunc I had the wrong character for divisor in the first one... in the few tests I did they worked. Edit: For some reason, my other edit didn't post... this should take care of you coming back in a week saying it doesn't work with numbers/floats/doubles. Func _ExecuteNums($vData, $vDec = ".") ; escape decmal chars Local Const $sDecRE = "([\\\.\^\$\|\[|\]\(\)\{\}\*\+\?\#])" $vDec = StringRegExpReplace($vDec, $sDecRE, "\\$1") Local $sRE = "(\d+[\" & $vDec & "\d]*\h*[\*/^]\h*\d+[\" & $vDec & "\d]*)" Return Execute(StringRegExpReplace($vData, $sRE, "\($1\)")) EndFunc
  20. That's a lot... I'd just use a SQLite database. It'd be much faster if you're moving through that many files. Anyway, you're missing 2 parameters in your _ArrayAdd()
  21. Probably... ConsoleWrite( _ExecuteNums("100^2-96^2") & @CRLF) Func _ExecuteNums($vData) Local Const $sRE = "(\d+\h*[\*\\\^]\h*\d+)" Return Execute(StringRegExpReplace($vData, $sRE, "\($1\)")) EndFunc I didn't exclusively test this... you may want to
  22. Lol, I used to do that to people!!! Turn their screens upside down too 😂 Global $iIdleThreshold = 20000 ; 5 seconds in milliseconds That's 20 seconds btw...
  23. Some GUIs have timeout features... Just MsgBox() off the top of my head has that option. But it's an "option", to force it on someone I don't agree with unless it's necessary for an application to continue running. At minimum there's a 5 second delay option, but max is 5 minutes unfortunately. Looks like it's time for you to write a notification pop-up logger 💪👍!
  24. Just state it's by design so it stands out <smh>
×
×
  • Create New...