Jump to content

Recommended Posts

Posted

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?

Posted

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.

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
Posted

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
;)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...