Jump to content

Message Box problem


saywell
 Share

Recommended Posts

Hi,

I'm a newbie, but have manged to write a couple of menu scripts that work - so getting there!!

I can use a message box with value 0 to display a pop-up message, but I would like to use a box that pops up OK/Cancel options.

This requires MsgBox(1,.......

The help files show that OK returns value 1, and Cancel, value 2.

My problem is how do I use these values in my script, so that pressing OK moves on to the next action, and cancel ... cancels and goes back to the menu?

Thanks,

William

Edited by saywell
Link to comment
Share on other sites

Hi,

I'm a newbie, but have manged to write a couple of menu scripts that work - so getting there!!

I can use a message box with value 0 to display a pop-up message, but I would like to use a box that pops up OK/Cancel options.

This requires MsgBox(1,.......

The help files show that OK returns value 1, and Cancel, value 2.

My problem is how do I use these values in my script, so that pressing OK moves on to the next action, and cancel ... cancels and goes back to the menu?

Thanks,

William

This is the generated script from the example at C:\Program Files\AutoIt3\Examples\GUI\Advanced\msgboxwizard.au3. Press "Copy" button then paste.

Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(49,"","press")
Select
   Case $iMsgBoxAnswer = 1 ;OK

   Case $iMsgBoxAnswer = 2 ;Cancel

EndSelect
Link to comment
Share on other sites

This is the generated script from the example at C:\Program Files\AutoIt3\Examples\GUI\Advanced\msgboxwizard.au3. Press "Copy" button then paste.

Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(49,"","press")
Select
   Case $iMsgBoxAnswer = 1 ;OK

   Case $iMsgBoxAnswer = 2 ;Cancel

EndSelect

Thanks - i hadn't found that wizard. However, it only answers half my question.

As an example, I have a menu that does a variety of things, and when closed, deletes a load of files containing personal data. To go back to it, it the user has to decrypt the files again from a CD. So I need an 'are you sure message' with OK to continue on with deleting and closing, and cancel to return to the GUI mneu without taking any action.

It's the latter I'm not sure how to do!

Here's the tail end of my menu:

Func CLOSEClicked()

MsgBox(0, "Closing", "Exiting and deleting files...")

; Delete C:\Test1 and all subdirs and files

DirRemove("c:\NHS_CFH_DICOM_Images\dv30", 1)

DirRemove("c:\NHS_CFH_DICOM_Images\dcmvwr", 1)

DirRemove("c:\NHS_CFH_DICOM_Images\misc", 1)

DirRemove("c:\NHS_CFH_DICOM_Images\dicomdat", 1)

DirRemove("c:\NHS_CFH_DICOM_Images", 1)

Exit

EndFunc

Currently it's just an advisory, and too late to do anything. I need a Msgbox(1, "closing", "Are you sure? This will delete all files and necessitate re-inserting the CD") with action accordingly.

Regards,

William

Link to comment
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
 Share

  • Recently Browsing   0 members

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