Leaderboard
Popular Content
Showing content with the highest reputation on 10/15/2021 in all areas
-
Assuming that the "mydomain" part may vary : Test1() Test2() ; get what you want Func Test1() Local $sInput = "mydomain\firstname.lastname" Local $sOutput = StringRegExpReplace($sInput, '.*?\\(.*)', "$1") Msgbox(0,"1", $sOutput) EndFunc ; or fire what you don't want Func Test2() Local $sInput = "mydomain\firstname.lastname" Local $sOutput = StringRegExpReplace($sInput, '[^\\]+\\', "") Msgbox(0,"2", $sOutput) EndFunc2 points
-
Version 1.7.0.1
10,047 downloads
Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None1 point -
StringRegExpReplace help
JamesDover reacted to Musashi for a topic
Yes ! Metacharacters : PCRE metacharacters are \ . ^ $ | [ ( { * + ? # which have one or more special meaning, depending on context. To insert a literal metacharacter, precede it by adding a backslash (this is called escaping (or quoting) a character). / is not a metacharacter and need not be escaped with \ Test1() Test2() Func Test1() Local $sInput = "mydomain/firstname.lastname" Local $sOutput = StringRegExpReplace($sInput, '.*?/(.*)', "$1") Msgbox(0,"1", $sOutput) EndFunc Func Test2() Local $sInput = "mydomain/firstname.lastname" Local $sOutput = StringRegExpReplace($sInput, '[^/]+/', "") Msgbox(0,"2", $sOutput) EndFunc1 point -
StringRegExpReplace help
JamesDover reacted to Musashi for a topic
#include <MsgBoxConstants.au3> Test1() Func Test1() Local $sInput = "mydomain\firstname.lastname" Local $sOutput1 = StringRegExpReplace($sInput, '(mydomain\\)', '$1') Local $sOutput2 = StringReplace($sInput, 'mydomain\', '') ConsoleWrite("Input = " & $sInput & @CRLF) ConsoleWrite("Output1 = " & $sOutput1 & @CRLF) ConsoleWrite("Output2 = " & $sOutput2 & @CRLF) EndFunc EDIT : @Jos was faster. BTW : In your case a simple StringReplace would also be sufficient.1 point -
StringRegExpReplace help
JamesDover reacted to Jos for a topic
You need to escape the backslash: Test1() Func Test1() Local $sInput = "mydomain\firstname.lastname" Local $sOutput = StringRegExpReplace($sInput, 'mydomain\\', '$1') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sOutput = ' & $sOutput & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc ;==>Test1 Jos1 point -
1 point
-
Is there a faster way to DllStructSetData for pixel data
Danyfirex reacted to markyrocks for a topic
Your example really doesn't show the problem bc it doesn't actually show where the bit array in question is coming from. But I believe that if you set the dllstruct size properly you can just set the whole array in one shot. Shouldn't be necessary to iterate over every element. If that doesn't work for whatever reason you should be able to use something like a memcopy or write process memory function to write the whole thing to the pointer at once. I will say that I think you're misinterpreting the point of the example. I also think that you have needless steps in here. Like why are you pulling the screenshot from c# and doing a conversion. If you capture from autoit once you have the handle to the capture you can do whatever you need to do with it. Maybe I'm missing something which is definitely possible bc of the example but that's just my 2c.1 point -
parse out ticket number
Skysnake reacted to seadoggie01 for a topic
Use RegEx and forget it, or spend an hour learning Jason JSON parsing? RegEx wins everytime!1 point -
Here is version using _StringBetween(): #Include <String.au3> $txt = '{"_expands":["participant","status","sla","requestType","serviceDesk"],"issueId":"1301831","issueKey":"GMS-600","requestTypeId":"300","serviceDeskId":"13","createdDate":{"iso8601":"2021-10-12T07:08:17-0700","jira"}}' $ticket = StringBetween($txt, '"issueKey":"', '"') ConsoleWrite($ticket & @CRLF) ; wrapper to return string instead of array Func StringBetween($sString, $sStart, $sEnd) $sReturn = _StringBetween($sString, $sStart, $sEnd) If @error Then Return '' Return $sReturn[0] EndFunc1 point
-
_GUICtrlComboBox_SetExtendedUI()1 point
-
Why? It's a fantastic visual assist and makes for faster reading and especially troubleshooting ... no doubt why it was implemented.1 point
-
GUICtrlCreateIco using GUISetBkColor for fake transparency?
Zedna reacted to pixelsearch for a topic
Hi rcmaehl Here is the display when I launch your script (the light grey background comes from my Windows theme, on your computer it's probably a white background) : So you're asking how to get rid of the red background displayed behind the icon ? I was lucky to find this thread where Yashied attached a function named _SetBkIcon() Unfortunately his function can't be downloaded from there as it's not hosted on AutoIt. Trying some google search, I found Yashied's function inside a script from funkey. Here is the result, based on the way you scripted it (the icon over the label) : #Include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Example() Func Example() $hGUI = GUICreate("Icons", 200, 250) $BKC = _WinAPI_GetSysColor($COLOR_WINDOW) ; window background (help file) ; ConsoleWrite("0x" & Hex($BKC, 6) & @crlf) ; 0xE3DFE0 (light grey, my windows theme) GUISetBkColor(0xFF0000) ; red (Gui) GUICtrlSetDefColor(0x0000FF) ; blue (controls) GUICtrlSetDefBKColor(0x00FF00) ; green (controls) GUICtrlCreateLabel("test label", 0, 0, 100, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER)) ; blue on green GUICtrlCreateLabel("", 0, 20, 100, 230) GUICtrlSetBkColor(-1, $BKC) ; light grey (background) $Icon1 = GUICtrlCreateIcon('', -1, 30, 40) ; left, top $Icon2 = GUICtrlCreateIcon('', -1, 20, 100) $Icon3 = GUICtrlCreateIcon('', -1, 25, 180) _GDIPlus_Startup() _SetBkIcon($Icon1, $BKC, @SystemDir & '\shell32.dll', 10, 32, 32) ; icon #10, width, height _SetBkIcon($Icon2, $BKC, @SystemDir & '\shell32.dll', 130, 48, 48) _SetBkIcon($Icon3, $BKC, @SystemDir & '\shell32.dll', 131, 48, 48) _GDIPlus_Shutdown() GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example ;============================================================================ Func _SetBkIcon($ControlID, $iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local Static $STM_SETIMAGE = 0x0172 Local $tIcon, $tID, $hDC, $hBackDC, $hBackSv, $hBitmap, $hImage, $hIcon, $hBkIcon $tIcon = DllStructCreate('hwnd') $tID = DllStructCreate('hwnd') $hIcon = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($hIcon[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) $tIcon = 0 $tID = 0 $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hBkIcon = DllCall($__g_hGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'hWnd', $hImage, 'int*', 0) $hBkIcon = $hBkIcon[2] _GDIPlus_ImageDispose($hImage) GUICtrlSendMsg($ControlID, $STM_SETIMAGE, $IMAGE_ICON, _WinAPI_CopyIcon($hBkIcon)) _WinAPI_RedrawWindow(GUICtrlGetHandle($ControlID)) _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_DeleteDC($hBackDC) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteObject($hBkIcon) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hIcon) Return SetError(0, 0, 1) EndFunc ;==>_SetBkIcon Hope it helps and good luck1 point