Leaderboard
Popular Content
Showing content with the highest reputation on 11/10/2017 in all areas
-
Mainly, the problem is : in the pattern newlines never match But it's a complicated way, it's much easier doing it in 2 steps #include <Array.au3> $Path ="test.html" ; first get the concerned part of text $part = StringRegExpReplace(FileRead($Path), '(?s).*<div class="app-details">(.*?)</div>.*' , "$1") ; then get non-empty-or-blank lines $aResults = StringRegExp($part, '\S\N+', 3) _ArrayDisplay($aResults)1 point
-
https://www.autoitscript.com/autoit3/docs/libfunctions/_StringBetween.htm1 point
-
when you compile a script the name of the executable is no more autoit3.exe, but it's "the name of your script" .exe, so you have to adjust accordingly the name of the executable specified in the RegWrite statement from"autoit3.exe" to "yourscriptname.exe". This should fix your issue of the compiled script. let us know the results of the fix...1 point
-
GUIRegisterMsg ($ WM_NOTIFY, "")
hackerheart reacted to Melba23 for a topic
hackerheart, Welcome to the AutoIt forums. As you have discovered, AutoIt will only run the last function defined in a GUIRegisterMsg line - so you have to combine both functions within a single handler and determine within that handler what code to run for the particular case. If you look inside my GUIListViewEx UDF (see my sig for the link) you will see how I have multiple options within the _GUIListViewEx_WM_NOTIFY_Handler function depending on exactly what message was intercepted by the GUIRegisterMsg call. M231 point -
Date/Time Pick coloring
robertocm reacted to argumentum for a topic
I really want to have this, so, it's a head start ( and example ) of coloring this control ( or part of it so far ) So don't be shy and pitch in #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> #include <WinAPITheme.au3> #include <GuiMonthCal.au3> Global $g_hDTP1, $g_hDTP2, $g_idMemo Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("DateTimePick coloring test", 500, 300) $g_idMemo = GUICtrlCreateEdit("", 2, 62, 496, 266, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUICtrlSetData($g_idMemo, "MonthCal child handle will be created each time it pops up." & @CRLF & @CRLF, 1) $g_hDTP1 = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 185, 20)) $g_hDTP2 = _GUICtrlDTP_Create($hGUI, 2, 32, 240) GUICtrlCreateLabel("<-- now we need to find how to color", 195, 5, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("this part of the control", 280, 30, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Set the display format _GUICtrlDTP_SetFormat($g_hDTP1, "ddd MMM dd, yyyy hh:mm ttt") _GUICtrlDTP_SetFormat($g_hDTP2, "ddd MMM dd, yyyy hh:mm ttt") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") WinActivate("DateTimePick coloring test") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2, $iCtrl $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hDTP1, $g_hDTP2 Switch $iCode Case $NM_SETFOCUS _WinAPI_SetThemeAppProperties(0) _DebugPrint("$NM_SETFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $NM_KILLFOCUS _WinAPI_SetThemeAppProperties(3) _DebugPrint("$NM_KILLFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $DTN_DROPDOWN ; Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar _DebugPrint("$DTN_DROPDOWN" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used ; Get month control child handle $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom) ;~ _WinAPI_SetWindowTheme($iCtrl, "", "") ; setting this here, does not change the size of the original canvas ;~ ; instead, for my simplicity, use _WinAPI_SetThemeAppProperties() OnFocus GUICtrlSetData($g_idMemo, "MonthCal child Handle: " & "0x" & Hex($iCtrl) & @CRLF, 1) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, 0x8BD4DF) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, 0xA9D7E4) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, 0x005894) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, 0x3F3F3F) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, 0xB2C2A9) Case $DTN_CLOSEUP ; Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar _DebugPrint("$DTN_CLOSEUP" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used Case $DTN_DATETIMECHANGE ; Sent by a date and time picker (DTP) control whenever a change occurs $tInfo = DllStructCreate($tagNMDATETIMECHANGE, $lParam) _DebugPrint("$DTN_DATETIMECHANGE" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Flag:" & @TAB & DllStructGetData($tInfo, "Flag") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case $DTN_FORMAT ; Sent by a date and time picker (DTP) control to request text to be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMAT, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) $tBuffer2 = DllStructCreate("char Display[64]", DllStructGetData($tInfo, "pDisplay")) _DebugPrint("$DTN_FORMAT" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Display:" & @TAB & DllStructGetData($tBuffer2, "Display")) Return 0 Case $DTN_FORMATQUERY ; Sent by a date and time picker (DTP) control to retrieve the maximum allowable size of the string that will be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_FORMATQUERY" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->SizeX:" & @TAB & DllStructGetData($tInfo, "SizeX") & @CRLF & _ "-->SizeY:" & @TAB & DllStructGetData($tBuffer2, "SizeY")) DllStructSetData($tInfo, "SizeX", 64) DllStructSetData($tInfo, "SizeY", 10) Return 0 Case $DTN_USERSTRING ; Sent by a date and time picker (DTP) control when a user finishes editing a string in the control $tInfo = DllStructCreate($tagNMDATETIMESTRING, $lParam) $tBuffer = DllStructCreate("char UserString[128]", DllStructGetData($tInfo, "UserString")) _DebugPrint("$DTN_USERSTRING" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->UserString:" & @TAB & DllStructGetData($tBuffer, "UserString") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags")) Return 0 Case $DTN_WMKEYDOWN ; Sent by a date and time picker (DTP) control when the user types in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_WMKEYDOWN" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->VirtKey:" & @TAB & DllStructGetData($tInfo, "VirtKey") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case Else _DebugPrint("$DTN_?????" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint Hopefully it'll turn into a UDF1 point