Sign in to follow this  
Followers 0
ITSky8

How to detect pop up dialog?

4 posts in this topic

Hello!

I would like to know how to detect the Pop Up dialog? As I have a Software which will pop up an error dialog to inform the user, and need to press he OK to shutdown the Software. For that, I would like to use AutoIT to write a monitoring tools, once detected the pop up from that Software, then Kill the process, and restart the Software again, so how to do so?

Share this post


Link to post
Share on other sites



Hello!

I would like to know how to detect the Pop Up dialog? As I have a Software which will pop up an error dialog to inform the user, and need to press he OK to shutdown the Software. For that, I would like to use AutoIT to write a monitoring tools, once detected the pop up from that Software, then Kill the process, and restart the Software again, so how to do so?

You can use WinWaitActive to pause a script until the pop up is produced.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ITSky8

Hi! I found solution for GUI, probably possible make this action for another app. windows. :)

#include <GuiConstants.au3>
#include <GuiMenu.au3>

Global $id_Open = 1000

$hGui = GUICreate("Menu test", 300, 200)

GUIRegisterMsg($WM_INITMENUPOPUP, "WM_INITMENUPOPUP")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

GUISetState()

Do
Until GUIGetMsg() = -3

Func WM_INITMENUPOPUP($hWnd, $Msg, $wParam, $lParam)
    
    ConsoleWrite("Popup menu appear" & @LF)

    Return $GUI_RUNDEFMSG
EndFunc

Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hMenu

    $hMenu = _GUICtrlMenu_CreatePopup ()
    _GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $id_Open)
    
    _GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
    _GUICtrlMenu_DestroyMenu ($hMenu)
    Return True
EndFunc   ;==>WM_CONTEXTMENU
;) Edited by rasim

Share this post


Link to post
Share on other sites

Hello!

Does this really work, does it really work or not?

ITSky8

Hi! I found solution for GUI, probably possible make this action for another app. windows. :)

#include <GuiConstants.au3>
#include <GuiMenu.au3>

Global $id_Open = 1000

$hGui = GUICreate("Menu test", 300, 200)

GUIRegisterMsg($WM_INITMENUPOPUP, "WM_INITMENUPOPUP")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

GUISetState()

Do
Until GUIGetMsg() = -3

Func WM_INITMENUPOPUP($hWnd, $Msg, $wParam, $lParam)
    
    ConsoleWrite("Popup menu appear" & @LF)

    Return $GUI_RUNDEFMSG
EndFunc

Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hMenu

    $hMenu = _GUICtrlMenu_CreatePopup ()
    _GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $id_Open)
    
    _GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
    _GUICtrlMenu_DestroyMenu ($hMenu)
    Return True
EndFunc   ;==>WM_CONTEXTMENU
;)

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
Sign in to follow this  
Followers 0