Jump to content
taylansan

Continue the script without waiting for MsgBox

Recommended Posts

taylansan

Dear AutoIt Community,

i want my script to pop-up a MsgBox, but at the same time to continue the script.

ConsoleWrite("Hello - 1" & @CRLF)
MsgBox(0, "", "Hello - 2")
ConsoleWrite("Hello - 3" & @CRLF)

If I do it as above, the script is paused and waiting for me to close the MsgBox to continue on the third line.

I don't want to set a timer to close the MsgBox either, because I will read the contents of the MsgBox but want my script continue to the next lines.

I didn't see any kind of restriction on the MsgBox help file that will cause the script to be paused.

Can you please tell / show me if this is possible?


TY.

Share this post


Link to post
Share on other sites
Melba23

taylansan,

search for "NotifyBox" by Yashied - that is a sort of MsgBox which does not pause the script. Or look at the Notify UDF in my sig - that produces small 2-line dialogs that pop in from the side of the screen.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MikahS

MsgBox is a blocking GUI that needs interaction before continuing on with the script. It essentially pauses the script waiting for a response.

It is not possible to continue in your script, unless you response to the MsgBox prompt.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
ViciousXUSMC

I usually use splashtexton() in those situations. 

Share this post


Link to post
Share on other sites
taylansan

8 years in AutoIt, 30 posts, still learning something new.

Thanks M23, MikahS, ViciousXUSMC


TY.

Share this post


Link to post
Share on other sites
Herb191

I just make a custom message box.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hMsgBoxGUI = GUICreate("", 248, 168)
GUISetBkColor(0xFFFFFF)

$SaveButton = GUICtrlCreateButton("Save", 32, 120, 75, 25)
$CancelButton = GUICtrlCreateButton("Cancel", 145, 120, 75, 25)
$Label1 = GUICtrlCreateLabel("Some text", 24, 64, 114, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x3399FF)
$Label2 = GUICtrlCreateLabel("Save this Search", 9, 16, 223, 36)
GUICtrlSetFont(-1, 20, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

    EndSwitch
WEnd

 

 

Edited by Herb191
I did not past all the code the first time

Share this post


Link to post
Share on other sites
ViciousXUSMC

Melba, not sure how often a feature like this is requested but I like your extended message box udf.  Would a non blocking parameter be easy enough to add to your udf? 

Share this post


Link to post
Share on other sites
Melba23

Herb191,

That dialog blocks just like the API-generated MsgBox and so does not meet the OP's requirement.

ViciousXUSMC,

Unfortunately adding a "non-blocking parameter" would mean a complete rewrite of the ExtMsgBox UDF - and as there is already my Notify UDF which does not block the script........

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
BrewManNH

You can always do it this way.

ConsoleWrite("Hello - 1" & @CRLF)
Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(4096, '''', ''Hello - 2'')"')
ConsoleWrite("Hello - 3" & @CRLF)

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
MikahS

8 years in AutoIt, 30 posts, still learning something new.

Thanks M23, MikahS, ViciousXUSMC

​It's a constant journey, but no problem. ;)

I learned something new as well.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Herb191

That dialog blocks just like the API-generated MsgBox and so does not meet the OP's requirement.

​Am a missing something basic here? If he wants to show a message box a still continue on with the script why wouldn’t this work?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_CancelButton

ConsoleWrite("Hello - 1" & @CRLF)
MakeMsgBox()
ConsoleWrite("Hello - 3" & @CRLF)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $g_CancelButton
            ExitLoop

    EndSwitch
WEnd

Func MakeMsgBox()
    $hMsgBoxGUI = GUICreate("", 248, 168)
    GUISetBkColor(0xFFFFFF)
    $SaveButton = GUICtrlCreateButton("Save", 32, 120, 75, 25)
    $g_CancelButton = GUICtrlCreateButton("Cancel", 145, 120, 75, 25)
    $Label1 = GUICtrlCreateLabel("Some text", 24, 64, 114, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    GUICtrlSetColor(-1, 0x3399FF)
    $Label2 = GUICtrlCreateLabel("Save this Search", 9, 16, 223, 36)
    GUICtrlSetFont(-1, 20, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)
EndFunc   ;==>MakeMsgBox

Share this post


Link to post
Share on other sites
Melba23

Herb191,

Unlike the code in your first post that will indeed meet the OP's requirement.  However, as it stands it is limited to a single dialog at a time, which may or may not be a problem.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MikahS

Something that might help others understand how MsgBox works in various ways: Modal MsgBox Styles - AutoIt Wiki


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
mikell

Using BrewManNH's way :

#pragma compile(AutoItExecuteAllowed, True) 
Opt("GuiOnEventMode", 1)
Global $stop = 0

GUICreate("My GUI", 250, 100) 
$label = GUICtrlCreateLabel("", 20, 30, 50, 20)
$btn = GUICtrlCreateButton("stop", 10, 60, 50, 20)
GUICtrlSetOnEvent(-1, "_stop")
GUISetState()  

For $i = 1 to 100
  If $i = 10 Then Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, '''', ''$i was 10'')"')
  If $stop Then Exitloop
  GuiCtrlSetData($label, $i)
  Sleep(300)
Next

Func _stop()
  $stop = 1
EndFunc

But this doesn't allow the use of variables from the main script in the MsgBox

Share this post


Link to post
Share on other sites
Melba23

mikell,

But this doesn't allow the use of variables from the main script in the MsgBox

Yes it does:

#pragma compile(AutoItExecuteAllowed, True)
Opt("GuiOnEventMode", 1)
Global $stop = 0, $sText = "Hi There"

GUICreate("My GUI", 250, 100)
$label = GUICtrlCreateLabel("", 20, 30, 50, 20)
$btn = GUICtrlCreateButton("stop", 10, 60, 50, 20)
GUICtrlSetOnEvent(-1, "_stop")
GUISetState()

For $i = 1 to 100
  If $i = 10 Then Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ""' & $sText & '"", ''$i was 10'')"')

  If $stop Then Exitloop
  GuiCtrlSetData($label, $i)
  Sleep(300)
Next

Func _stop()
  $stop = 1
EndFunc

You just need to get the quotes right - and, yes, it took me several goes!

M23 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

<Argh>
My 'quote trouble' hit me again...

Thanks Melba  :)

Share this post


Link to post
Share on other sites
LarsJ

If you want to get an answer back from your MsgBox:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

#pragma compile(AutoItExecuteAllowed, True)

Opt( "GuiOnEventMode", 1 )

Global $iStop = 0, $lbl2, $lbl3

Local $hGui = GUICreate( "My GUI", 250, 100 )
GUISetOnEvent( $GUI_EVENT_CLOSE, "Stop" )
GUIRegisterMsg( $WM_USER, "WM_MSGBOX" )

GUICtrlCreateLabel( "Loop: ", 10, 10, 30, 20 )
Local $lbl1 = GUICtrlCreateLabel( "", 50, 10, 30, 20 )

GUICtrlCreateLabel( "MsgBox: ", 110, 10, 50, 20 )
$lbl2 = GUICtrlCreateLabel( "", 170, 10, 30, 20 )
GUICtrlCreateLabel( "Answer: ", 110, 40, 50, 20 )
$lbl3 = GUICtrlCreateLabel( "", 170, 40, 30, 20 )

Local $btn = GUICtrlCreateButton( "Stop", 10, 60, 50, 20 )
GUICtrlSetOnEvent( -1, "Stop" )

Local $sText = "Hi There"

GUISetState()


For $i = 1 to 100
  If $i = 10 Then Run( @AutoItExe & ' /AutoIt3ExecuteLine "DllCall(''user32.dll'', ''lresult'', ''SendMessageW'', ''hwnd'', ""' & $hGui & '"", ''uint'', ""' & $WM_USER & '"", ''wparam'', ""' & $i & '"", ''lparam'', MsgBox( ""' & $MB_OKCANCEL    & '"", ""' & $sText & '"", ''I was '' & ""' & $i & '"" ))"' )
  If $i = 15 Then Run( @AutoItExe & ' /AutoIt3ExecuteLine "DllCall(''user32.dll'', ''lresult'', ''SendMessageW'', ''hwnd'', ""' & $hGui & '"", ''uint'', ""' & $WM_USER & '"", ''wparam'', ""' & $i & '"", ''lparam'', MsgBox( ""' & $MB_YESNOCANCEL & '"", ""' & $sText & '"", ''I was '' & ""' & $i & '"" ))"' )
  If $i = 20 Then Run( @AutoItExe & ' /AutoIt3ExecuteLine "DllCall(''user32.dll'', ''lresult'', ''SendMessageW'', ''hwnd'', ""' & $hGui & '"", ''uint'', ""' & $WM_USER & '"", ''wparam'', ""' & $i & '"", ''lparam'', MsgBox( ""' & $MB_RETRYCANCEL & '"", ""' & $sText & '"", ''I was '' & ""' & $i & '"" ))"' )

  If $iStop Then Exitloop
  GuiCtrlSetData( $lbl1, $i )
  Sleep(300)
Next

Func Stop()
  $iStop = 1
EndFunc

Func WM_MSGBOX( $hWnd, $iMsg, $wParam, $lParam )
  Switch $wParam
    Case 10, 15, 20
      GuiCtrlSetData( $lbl2, Int( $wParam ) )
      GuiCtrlSetData( $lbl3, Int( $lParam ) )
  EndSwitch
EndFunc

 

Share this post


Link to post
Share on other sites
Chimp

one more way
this can spawn an external independant MsgBox detached from the main script, but from the main script you can still check what has been pressed on the external MsgBox. This mode can also be used for InputBox as well

Local $pid = SpawnMsgBox(1, "Extern MsgBox", "I am detached from the main script") ; Spawn an independant msgbox


Local $msg = "Hi" & @CRLF & " hit OK to check external MsgBox status"
While 1
    MsgBox(0, "internal MsgBox", $msg)
    Switch CheckExternal($pid)
        Case 1 ; OK Button Pressed
            MsgBox(0, "Result", "OK button was pressed on external MsgBox")
            Exit
        Case 2 ; Cancel Button Pressed
            MsgBox(0, "Result", "Cancel button was pressed on external MsgBox")
            Exit
        Case -1 ;
            MsgBox(0, "Result", "External MsgBox closed for timeout")
            Exit
    EndSwitch
    $msg = "At " & @HOUR & ":" & @MIN & ":" & @SEC & " external MsgBox was still there"
WEnd

; this receives result from the external MsgBox
Func CheckExternal($pid)
    Return StdoutRead($pid)
EndFunc   ;==>CheckExternal

; This spawn an MsgBox and returns the related PID
Func SpawnMsgBox($iflag = 0, $sTitle = "", $sText = "", $iTimeout = 0)
    Return Run(@AutoItExe & ' /AutoIt3ExecuteLine "ConsoleWrite(MsgBox(' & $iflag & ', ''' & $sTitle & ''', ''' & $sText & ''', ' & $iTimeout & '))"', "", "", 0x2) ; 0x2 ($STDOUT_CHILD)
EndFunc   ;==>SpawnMsgBox

 

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • xtcislove
      By xtcislove
      Hello,
      as a start in Autoit i tried something i was missing since im using Autoit. 

      I build a custom MessageBox which has a large amount of custom options and which scales its size on the parameters you set. 

      Aviable Settings:
      -Title
      -Unlimited Buttons
      -Text Color (Buttons, Text)

      -Background Color (Msgbox, Buttons, Label) 

      -Button Timeout
      -Autoclose Timeout
      -Icon (Default, No Icon, Custom)

      -Label/ Button Style. 
      -Transparency

      I tried to keep this as close as i could to a Msgbox i was used too on my batch times.

      After i was ready i realised, @Melba23 probably build a way better msgbox which would have suit my needs enterly, anyway thanks to @Melba23 because i use his Stringsize UDF. 

       
       
      local $Message = _sMsgBox("Test", 6, "Continue?") if @extended <> -1 Then MsgBox(0, @extended, $Message&" Button pressed")  
      ScalingMessageBox.au3
    • SkysLastChance
      By SkysLastChance
      I am having a hard time understanding why this is not working. I was hoping some one could help explain it to me. 
      $tags = $oIE.document.GetElementsByTagName("input") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "fTs-p3298-l0 wplEditControl" Then $target = $tag ExitLoop EndIF Next MsgBox(0,"",$target) If $target = "fTs-p3298-l0 wplEditControl" THEN MsgBox(0,"","itworked") I have tried 
       MsgBox(0,"",$target.Attribute)  MsgBox(0,"",$target.Value)  MsgBox(0,"",$target.InnerText) I would expect to see this in the msgbox
      fTs-p3298-l0 wplEditControl  
    • funkey
      By funkey
      Hello,
      it's quite often, that someone asks how to change the texts of the MsgBox buttons or the InputBox buttons or how to change the position of ta MsgBox. Since years I use CBT hooks for that, but now I made a small UDF out of it for the ease of use. Of course you can build your own GUI or use already existing UDFs to do the same, but I like this way and you can hack (hook) the inbuild InputBox.
       
      HookDlgBox.au3
      #include-once #include <WinAPI.au3> Global Const $tagCBT_CREATEWND = "ptr lpcs;HWND tagCBT_CREATEWND" Global Const $tagCREATESTRUCT = "ptr lpCreateParams;handle hInstance;HWND hMenu;HWND hwndParent;int cy;int cx;int y;int x;LONG style;ptr lpszName;ptr lpszClass;DWORD dwExStyle" Global $g__hProcDlgBox = DllCallbackRegister("__DlgBox_CbtHookProc", "int", "int;int;int") Global $g__TIdDlgBox = _WinAPI_GetCurrentThreadId() Global $g__hHookDlgBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($g__hProcDlgBox), 0, $g__TIdDlgBox) Global Const $g__MaxDlgBtns = 5 ; maximum of 5 buttons to rename text Global Const $g__MaxDlgItemId = 11 ; maximun ID of buttons to search is 11 as this is the maximun used in Messagebox Global $g__DlgBoxPosX, $g__DlgBoxPosY, $g__DlgBoxWidth, $g__DlgBoxHeight Global $g__aDlgBoxBtnText[$g__MaxDlgBtns] Global $g__DlgBtnCount = 0 _DlgBox_SetDefaults() OnAutoItExitRegister("__DlgBox_UnregisterHook") Func _DlgBox_SetButtonNames($TxtBtn1 = Default, $TxtBtn2 = Default, $TxtBtn3 = Default, $TxtBtn4 = Default, $TxtBtn5 = Default) $g__aDlgBoxBtnText[0] = $TxtBtn1 $g__aDlgBoxBtnText[1] = $TxtBtn2 $g__aDlgBoxBtnText[2] = $TxtBtn3 $g__aDlgBoxBtnText[3] = $TxtBtn4 $g__aDlgBoxBtnText[4] = $TxtBtn5 $g__DlgBtnCount = @NumParams EndFunc ;==>_DlgBox_SetButtonNames Func _DlgBox_SetPosition($x = Default, $y = Default) ;only for MsgBox, not working and not needed for InputBox $g__DlgBoxPosX = $x $g__DlgBoxPosY = $y EndFunc ;==>_DlgBox_SetPosition Func _DlgBox_SetSize($w = Default, $h = Default) $g__DlgBoxWidth = $w $g__DlgBoxHeight = $h EndFunc ;==>_DlgBox_SetSize Func _DlgBox_SetDefaults() $g__DlgBoxPosX = Default $g__DlgBoxPosY = Default $g__DlgBoxWidth = Default $g__DlgBoxHeight = Default For $i = 0 To UBound($g__aDlgBoxBtnText) - 1 $g__aDlgBoxBtnText[$i] = Default Next EndFunc ;==>_DlgBox_SetDefaults Func __DlgBox_CbtHookProc($nCode, $wParam, $lParam) Local $tcw, $tcs Local $iSearch = 0 Local $ahBtn[$g__DlgBtnCount] If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndIf Switch $nCode Case 3 ;5=HCBT_CREATEWND If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialoig window class $tcw = DllStructCreate($tagCBT_CREATEWND, $lParam) $tcs = DllStructCreate($tagCREATESTRUCT, DllStructGetData($tcw, "lpcs")) If $g__DlgBoxPosX <> Default Then DllStructSetData($tcs, "x", $g__DlgBoxPosX) If $g__DlgBoxPosY <> Default Then DllStructSetData($tcs, "y", $g__DlgBoxPosY) If $g__DlgBoxWidth <> Default Then DllStructSetData($tcs, "cx", $g__DlgBoxWidth) If $g__DlgBoxHeight <> Default Then DllStructSetData($tcs, "cy", $g__DlgBoxHeight) EndIf Case 5 ;5=HCBT_ACTIVATE For $i = 1 To $g__MaxDlgItemId If IsHWnd(_WinAPI_GetDlgItem($wParam, $i)) Then If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch]) $iSearch += 1 If $iSearch >= UBound($ahBtn) Then ExitLoop EndIf Next EndSwitch Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndFunc ;==>__DlgBox_CbtHookProc Func __DlgBox_UnregisterHook() _WinAPI_UnhookWindowsHookEx($g__hHookDlgBox) DllCallbackFree($g__hProcDlgBox) EndFunc ;==>__DlgBox_UnregisterHook Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString) Local $aRet = DllCall('user32.dll', "int", "SetDlgItemText", _ "hwnd", $hDlg, _ "int", $nIDDlgItem, _ "str", $lpString) Return $aRet[0] EndFunc ;==>_WinAPI_SetDlgItemText  
      Simple example to see how to use it
      #include "HookDlgBox.au3" _DlgBox_SetButtonNames("1", "two", "3") MsgBox(4, "Test 1", "Custom button texts") _DlgBox_SetPosition(20, 20) MsgBox(66, "Test 2", "Custom position and button texts") _DlgBox_SetButtonNames("Submit", "Don't submit", "Don't know") InputBox("Test 3", "Where were you born?", "Planet Earth") _DlgBox_SetSize(800, 800) InputBox("Test 4", "Where were you born?", "Planet Earth") _DlgBox_SetSize(Default, 800) MsgBox(66, "Test 5", "Strange but working") _DlgBox_SetButtonNames(Default, "Wait", "What?") _DlgBox_SetSize(Default, Default) _DlgBox_SetPosition(500, 500) MsgBox(66, "Test 6", "So far so good!") _DlgBox_SetDefaults() MsgBox(6, "Test 7", "Default position and button texts") Hope you like it.
       
      Best regards
      funkey
      HookDlgBox Example.au3
      HookDlgBox.au3
    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Guys i am working on automating a flashing tool..When flashing is started if there is any error in connection it pops's up a error window...(as shown below)

       whenever this popup appears i need a msgbox to appear saying "error occured" how can i do this?
      Thanks

    • Nareshm
      By Nareshm
      I have autoit script like this :
      winActivate ("BillReceipt") ControlClick ( "BillReceipt", "", "[NAME:winviewer]", "right") Send ( "{ENTER}") WinWait ("Print") ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]") Winwait ("Save As") WinActivate ("Save As") Send ("{TAB 5} {Backspace} ^v {Enter}") I need Saved successfully msgbox with file name as i saved like Filename.extension (Example = test.pdf is saved successfull)

      Please Help
×