Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/02/2024 in all areas

  1. Hi everybody I needed to display a couple of MsgBox with altered buttons captions. Here is the way I just scripted it, using Timers (thanks to @KaFu for the idea, a few months ago) #include <MsgBoxConstants.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Global $g_aCaption, $g_sTitle ; 2 global variables for _TimerProc() Dim $g_aCaption[3] = ["Hello", "How", "Are You ?"] ; 3 buttons (max) in MsgBox (not counting the 4th special button $MB_HELP) $g_sTitle = "This is MsgBox #1" Local $iChoice1 = _MsgBox(BitOr($MB_YESNOCANCEL, $MB_DEFBUTTON3, $MB_TOPMOST, $MB_ICONQUESTION), $g_sTitle, _ "1st line of text" & @crlf & "2nd line of text") ; ConsoleWrite("A: " & $iChoice1 & @crlf) Dim $g_aCaption[2] = ["Copy text", "Ok"] ; 2 buttons $g_sTitle = "This is MsgBox #2" Local $iChoice2 = _MsgBox(BitOr($MB_OKCANCEL, $MB_DEFBUTTON2, $MB_TOPMOST), $g_sTitle, _ "I need these 2 buttons captions in another script)") ; think of $MB_YESNO too (2 buttons without Esc allowed) ; ConsoleWrite("B: " & $iChoice2 & @crlf) Dim $g_aCaption[1] = ["Hello !"] ; 1 button (not really useful but well...) $g_sTitle = "This is MsgBox #3" Local $iChoice3 = _MsgBox(BitOr($MB_OK, $MB_TOPMOST), $g_sTitle, _ "Revolution 9, such a strange song", 5) ; timaout 5s (returns -1 if timed out) ; ConsoleWrite("C: " & $iChoice3 & @crlf) ;=============================================== Func _MsgBox($iFlag, $g_sTitle, ByRef $sText, $iTimeOut = 0, $hWnd = 0) Local $hTimerProc = DllCallbackRegister('_TimerProc', 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, 10, DllCallbackGetPtr($hTimerProc)) Local $iChoice = MsgBox($iFlag, $g_sTitle, $sText, $iTimeOut, $hWnd) _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) Return $iChoice EndFunc ;==>_MsgBox ;=============================================== Func _TimerProc($hWnd, $iMsg, $iTimerID, $iTime) If WinActive($g_sTitle) Then _WinAPI_KillTimer(0, $iTimerID) If Ubound($g_aCaption) > 3 Then ReDim $g_aCaption[3] For $i = 0 To Ubound($g_aCaption) - 1 ControlSetText($g_sTitle, "", "Button" & ($i + 1), $g_aCaption[$i]) Next EndIf EndFunc ;==>_TimerProc If you guys got comments or improvements on this, please share your thoughts here, thanks !
    1 point
  2. That one-line command shown means you have not installed the Full SciTE4AutoIt3 installer, so also do not have Autoit3Wrapper and au3stripper options. Just install the full version and you should be in business.
    1 point
  3. No, it was based on the snippets declared in the vscode built-in extension "PHP Language Basics" I did consider using "func" instead, but did change it right away and forgot about it as i kept working Based on your feedback, it is clear it could cause some to miss out on the option. I will add the change for the next release , thanks Happy to hear! C# is a pretty great language, i think But i don't think i can help make that developer experience any better
    1 point
×
×
  • Create New...