Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/06/2024 in all areas

  1. 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
    1 point
  2. UEZ

    AutoIt Snippets

    Get the binary type for exe / dll file. ;Coded by UEZ build 2024-04-08 #AutoIt3Wrapper_UseX64 = y #include <WinAPIFiles.au3> #include <WinAPIProc.au3> Global $sFile = FileOpenDialog("Select a DLL file", "", "File (*.dll;*.exe)", $FD_FILEMUSTEXIST) If @error Then Exit MsgBox($MB_ICONINFORMATION, "File Binary Type", StringRegExpReplace($sFile, ".+\\(.+)", "$1") & " = " & _WinAPI_GetBinaryType2($sFile)) ; #FUNCTION# ==================================================================================================================== ; Author.........: UEZ ; Modified.......: ; =============================================================================================================================== Func _WinAPI_GetBinaryType2($sFile) Local Const $hFile = _WinAPI_CreateFile($sFile, 2, 2) If Not $hFile Or @error Then Return SetError(1, 0, 0) Local Const $hMapping = _WinAPI_CreateFileMapping($hFile, 0, Null, $PAGE_READONLY, Null) If Not $hMapping Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf Local Const $pAddress = _WinAPI_MapViewOfFile($hMapping, 0, 0, $FILE_MAP_READ) If Not $pAddress Or @error Then __ReturnGBT2($hMapping, $hFile, 3) Local $aHeader = DllCall("Dbghelp.dll", "ptr", "ImageNtHeader", "ptr", $pAddress) If @error Or IsArray($aHeader) = 0 Then Return __ReturnGBT2($hMapping, $hFile, 4) Local $tIMAGE_NT_HEADERS = DllStructCreate("dword Signature;ptr FileHeader;ptr OptionalHeader;", $aHeader[0]) If @error Or Not IsDllStruct($tIMAGE_NT_HEADERS) Then Return __ReturnGBT2($hMapping, $hFile, 5) Local $tIMAGE_FILE_HEADER = DllStructCreate("word Machine;word NumberOfSections;dword TimeDateStamp;dword PointerToSymbolTable;dword NumberOfSymbols;word SizeOfOptionalHeader;word Characteristics;", DllStructGetPtr($tIMAGE_NT_HEADERS) + 4) If @error Or Not IsDllStruct($tIMAGE_FILE_HEADER) Then Return __ReturnGBT2($hMapping, $hFile, 6) __ReturnGBT2($hMapping, $hFile, 0) Switch $tIMAGE_FILE_HEADER.Machine Case 0x014c Return "x86" Case 0x0200 Return "Intel Itanium" Case 0x8664 Return "x64" Case Else Return "Error" EndSwitch EndFunc ;==>_WinAPI_GetBinaryType2 Func __ReturnGBT2($hMapping, $hFile, $iError) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) If $iError Then Return SetError($iError, 0, 0) EndFunc ;==>__ReturnGBT2
    1 point
  3. Ya, i thought it was a bit dark too, found a how to/tips page online that said it was the most commonly used for a dark theme , so thought i'd go with it. But i liked the Scite colors better. Only thing (personally) I like better about mine is you don't have to get used to different colors for the S0-S15, vs just different hues of the same colors. But that's just me, and no need to reinvent the wheel or change whats worked for 30 years. Look forward to seeing what you come up with for the website. Pretty cool upgrade once you can get the css project for the chm to an active stage.
    1 point
  4. TerryF, Glad to hear it - thanks for testing. I will release a new version soon. M23
    1 point
  5. How often do you need the hint about providing more information/context? How often should we ask for your (working) code? What did you tried so far? Please try to take into account and apply the things that users answer you here, otherwise you may no longer receive any answers. Best regards Sven
    1 point
  6. it was resolved #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") Global $id_1 = _CreateInput("INPUT1", 20, 20, 150, 30, "0xB6FF00", 10) Global $id_2 = _CreateInput("INPUT2", 20, 60, 150, 30, "0xB6FF00") Global $id_3 = _CreateInput("INPUT3", 20, 100, 150, 35, "0xFFD800", 10) Global $id_4 = _CreateInput("INPUT4", 20, 145, 150, 35, "0xFFD800") Global $id_5 = _CreateInput("INPUT5", 20, 190, 150, 40, "0xFFB400", 10) Global $id_6 = _CreateInput("INPUT6", 20, 240, 150, 40, "0xFFB400") Global $id_7 = _CreateInputWL("Test Label:", "INPUT7", 220, 20, 150, 30, "0xB6FF00", 10) Global $id_8 = _CreateInputWL("Test Label:", "INPUT8", 220, 60, 150, 30, "0xB6FF00") Global $id_9 = _CreateInputWL("Test Label:", "INPUT9", 220, 100, 150, 30, "0xB6FF00", 10) Global $id_10 = _CreateInputWL("Test Label:", "INPUT10", 220, 145, 150, 30, "0xB6FF00") Global $id_11 = _CreateInputWL("Test Label:", "INPUT11", 220, 190, 150, 40, "0xFFB400", 10) Global $id_12 = _CreateInputWL("Test Label:", "INPUT12", 220, 240, 150, 40, "0xFFB400") GUISetState() Sleep(3000) GUICtrlSetData($id_1, "[test] gyps") GUICtrlSetData($id_7, "[test] gyps") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;-------------------------------------------------------------------------------------------------------------------------------- Func _CreateInput($Text, $Left, $Top, $Width, $Height, $Color, $Corner = $Height / 2) GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Corner, $Height, 0, 0, 0, $Height) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Width - $Corner, $Height, $Width, 0, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) GUICtrlSetState(-1, $GUI_DISABLE) $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.2), $Width - ($Corner * 2), $Height * 0.6, -1, $WS_EX_TOOLWINDOW) GUICtrlSetFont(-1, Int($Height * 0.4), 400) GUICtrlSetBkColor(-1, $Color) Return $idInput1 EndFunc ;==>_CreateInput ;-------------------------------------------------------------------------------------------------------------------------------- Func _CreateInputWL($Label, $Text, $Left, $Top, $Width, $Height, $Color, $Corner = $Height / 2) GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Corner, $Height, 0, 0, 0, $Height) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $Corner, 0) GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, $Width - $Corner, $Height, $Width, 0, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel($Label, $Left + $Corner, $Top, $Width - ($Corner * 2), $Height * 0.4) GUICtrlSetBkColor(-1, $Color) GUICtrlSetFont(-1, Int($Height * 0.25)) $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.35), $Width - ($Corner * 2), $Height * 0.60, -1, $WS_EX_TOOLWINDOW) GUICtrlSetFont(-1, Int($Height * 0.35)) GUICtrlSetBkColor(-1, $Color) Return $idInput1 EndFunc ;==>_CreateInputWL ;--------------------------------------------------------------------------------------------------------------------------------
    1 point
  7. Hello I need this : But how to add exe and not GUI for search in one image. Thank you
    0 points
×
×
  • Create New...