win32con.MB_YESNO and win32con.MB_OK

Discussion created by jplay on Sep 27, 2012
Latest reply on Sep 27, 2012 by jplay
I'm trying out pop-up message windows and am not having much luck. I want to ask the user if certain files exist before beginning a process then instruct the user to download the files if they don't already exist. I opted to throw up a message box that asks if the files exist using the win32api.MessageBox / win32con.MB_YESNO functions, then if the answer is 'no' another message box using win32con.MB_OK.

The script runs and a message box appears with the yes/no buttons, but nothing happens if you click either button. I actually have to click the 'Close' button on the main script dialog before only the 'no' button will work in the message box. But then I get a process canceled by user error.

While I'm sure that there is another way to do this, now that I've started down this path I'm determined to figure it out. Anybody got any ideas? I think I've checked every link on 7 pages of Google results and still have no idea what I'm doing wrong.

[HTML]import arcpy, win32com.client, win32api, win32con
from win32con import MB_OK, MB_YESNO

result = win32api.MessageBox(0, "Do the files exist?.", "Shapefiles", win32con.MB_YESNO);
if result == win32con.IDYES:
    win32api.MessageBox(0, "Please downloaded and restart the script.", "Shapefiles", win32con.MB_OK);

arcpy.AddMessage("did this work?")[/HTML]