Jump to content
Sign in to follow this  

Identify a msgbox and press OK

Recommended Posts



have a Adobe distiller that make me crazy.

For varius reasons it stop when find .tmp files; these files are creted from another process that i can't touch.

Whe Distiller find this .tmp file return an error, can't find anywhere a set to skip this alert.

so i think to make an 'agent' that

- monitor open windows

- when find this msgbox take focus on it

- press return

post all info obtained from Au3Info.exe :

>>>> Window <<<<
Title:  Acrobat Distiller
Class:  #32770
Position:   458, 351
Size:   356, 139
Style:  0x94C801C5
ExStyle:    0x00010101
Handle: 0x085E00DA

>>>> Control <<<<
Class:  Static
Instance:   2
ClassnameNN:    Static2
Advanced (Class):   [CLASS:Static; INSTANCE:2]
ID: 65535
Text:   C:\data\SV\in\MAIDAR_SV9678.tmp
Cannot open this file.

Please check that the correct path and filename are given.
Position:   62, 11
Size:   282, 54
ControlClick Coords:    81, 26
Style:  0x50022080
ExStyle:    0x00000004
Handle: 0x000200D2

>>>> Mouse <<<<
Position:   604, 410
Cursor ID:  0
Color:  0xD4D0C8

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Cannot open this file.

Please check that the correct path and filename are given.

>>>> Hidden Text <<<<

anyone can help me to solve this ?

thank you,


Share this post

Link to post
Share on other sites

It's your lucky day. Here is one I made some time ago.

#Region Options
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)
Opt("TrayAutoPause", 0)
#EndRegion Options

#Region Declaraions
Global $g_DEBUG = True
Global $g_sVersion = FileGetVersion(@ScriptFullPath)
;Check if mouse buttons have been swaped
Global $g_sPrimary = 'left'
Global $g_sSecondary = 'right'
Global $g_Swapped = RegRead('HKCU\Control Panel\Mouse', 'SwapMouseButtons')
If $g_Swapped <> '0' Then
  $g_sPrimary = 'right'
  $g_sSecondary = 'left'
Global $g_iInterval = 500
Global $g_fLogClosed = True
Global $g_sLogFile = @ScriptDir & "\" & StringLeft(@ScriptName, StringInStr(@ScriptName, ".") - 1) & ".log"
Global $g_aWindows[1][3] = [[0, '', '']]
Global $g_sIniFile = @ScriptDir & "\" & StringLeft(@ScriptName, StringInStr(@ScriptName, ".") - 1) & ".ini"
#EndRegion Declaraions

#Region Includes
#include <file.au3>
#EndRegion Includes


While 1

Func _KillPopup()
  Local $sText = ''
  Local $sTitle = ''
  Local $iTime = 0

  For $i = 1 To $g_aWindows[0][0] Step 1
    WinActivate($g_aWindows[$i][0], $g_aWindows[$i][1])
    If WinActive($g_aWindows[$i][0], $g_aWindows[$i][1]) Then
      If $g_fLogClosed Then
        ; Get some details from the window
        $sTitle = WinGetTitle($g_aWindows[$i][0], $g_aWindows[$i][1])
        $sText = WinGetText($g_aWindows[$i][0], $g_aWindows[$i][1])
        $sText = StringRegExpReplace($sText, "\n", "\\n")
      If $g_aWindows[$i][2] Then
        ControlSend($g_aWindows[$i][0], $g_aWindows[$i][1], $g_aWindows[$i][2], "{ENTER}")
        WinClose($g_aWindows[$i][0], $g_aWindows[$i][1])
      If $g_fLogClosed Then
        ; Give the window time to close
        ; check if window still active
        $iTime = TimerInit()
        While TimerDiff($iTime) < $g_iInterval And WinActive($g_aWindows[$i][0], $g_aWindows[$i][1])
          WinActivate($g_aWindows[$i][0], $g_aWindows[$i][1])
        WinActivate($g_aWindows[$i][0], $g_aWindows[$i][1])
        If WinActive($g_aWindows[$i][0], $g_aWindows[$i][1]) Then
          _FileWriteLog($g_sLogFile, 'Attempted to close window' & $i & '|' & $sTitle & '|' & $sText)
          _FileWriteLog($g_sLogFile, 'Closed window' & $i & '|' & $sTitle & '|' & $sText)
EndFunc   ;==>_KillPopup

Func _ReadIniFile()
  Local $sValue = ''
  Local $iWin = 1
  Local $aParts = 0

  $sValue = IniRead($g_sIniFile, 'SETTINGS', 'CheckFrequency', '500')
  If $sValue <> '' Then
    $g_iInterval = Int(Number($sValue))
  $sValue = IniRead($g_sIniFile, 'SETTINGS', 'LogWindowsClosed', 'Y')
  If $sValue <> '' Then
    $g_fLogClosed = (StringInStr('YyTt1', StringLeft(StringStripWS($sValue, 8), 1)) <> 0)
  $sValue = IniRead($g_sIniFile, 'SETTINGS', 'Logfile', '')
  If $sValue <> '' Then
    $g_sLogFile = $sValue

  $sValue = IniRead($g_sIniFile, 'WINDOWS', 'window' & $iWin, '')
  While $sValue <> ''
    $aParts = StringSplit($sValue, '|')
    If IsArray($aParts) Then
      $g_aWindows[0][0] += 1
      ReDim $g_aWindows[$g_aWindows[0][0] + 1][3]
      For $i = 1 To $aParts[0] Step 1
        $g_aWindows[$iWin][$i - 1] = $aParts[$i]
    $iWin += 1
    $sValue = IniRead($g_sIniFile, 'WINDOWS', 'window' & $iWin, '')

EndFunc   ;==>_ReadIniFile

save as popupclear.ini

window1=Acrobat Distiller|Cannot open this file|OK


Popupclear uses popupclear.ini to store its configuration and details of the windows it should attempt to close.

Example ini file






window1=Data Editor|File has not been saved|&Yes

window2=Data Editor|Some selected or nominated itemss|No


Settings Section

This section controls the general operation of Popupclear.exe

CheckFrequency - is the frequency that popupclear will check for the windows that it needs to close. The value is specified in milliseconds. It is recommended that this should not be set to less that 500 especially if there are a lot of windows to check for. If you notice that popoupclear is using a lot of CPU time then try increasing this value.

LogWindowsClosed - if this is set to Y then popupclear will log the details of all the windows it has closed.

Logfile - is the name of the file that popupclear will use to log the details of windows it has closed.

Windows Section

This section contains the details of the windows that popupclear should attempt to close. The general format is:

window<n>=<Window Caption>|<Window Text>|<Button Text>

<Window Caption> - is the text that appears in the windows title bar. It is not necessary to use all of the text in the title bar as popupclear will do a partial match.

<Window Text> - is optional. This is any text that you can see on the window. It should be used to differentiate between different windows when there may be more than one window with the same caption. Only sufficient text to uniquely identify the window needs to be entered.

<Button Text> - is the text on the button that popupclear should click to close the window. If any letters on the button are underlined when the Alt key is pressed should be preceded with an ampersand. e.g. Yes should be entered as &Yes

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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