Jump to content

Need script to close recurring confirmation boxes.


 Share

Recommended Posts

Hi,

In my charting program, when I close a chart, it will pop a confirmation asking "Save changes to layout?", and I just click "No".

Please see attachment.post-24895-1206324453_thumb.jpg

I have no issue with just one confirmation. It's only when I close more than one chart that it asks more than one time. That means, it will asks "Save changes to layout3?", "Save changes to layout4?", "Save changes to layout5?" and so on.

I don't know how to code a script to handle multiple confirmation boxes. Can someone please help?

Link to comment
Share on other sites

Hi,

In my charting program, when I close a chart, it will pop a confirmation asking "Save changes to layout?", and I just click "No".

Please see attachment.post-24895-1206324453_thumb.jpg

I have no issue with just one confirmation. It's only when I close more than one chart that it asks more than one time. That means, it will asks "Save changes to layout3?", "Save changes to layout4?", "Save changes to layout5?" and so on.

I don't know how to code a script to handle multiple confirmation boxes. Can someone please help?

If you already know how to test for the window with WinExists(), then you can just keep doing it in a loop until it returns 0. If there are multiple windows matching the same parameters, it will act on each until there aren't any left. Be sure to put an appropriate delay in the loop, i.e. Sleep(500).

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

PsaltyDS,

My code does not work.

CODE
WinWait("MetaStock Professional", "Save changes to Layo", 1)

Do

If WinExists("MetaStock Professional", "Save changes to Layo") Then

WinActivate("MetaStock Professional", "Save changes to Layo")

WinWaitActive("MetaStock Professional", "Save changes to Layo")

Send("n")

Sleep(2000)

EndIf

Until WinExists("MetaStock Professional", "Save changes to Layo") = 0

Can you suggest corrections or something better?

Link to comment
Share on other sites

PsaltyDS,

My code does not work.

CODE
WinWait("MetaStock Professional", "Save changes to Layo", 1)

Do

If WinExists("MetaStock Professional", "Save changes to Layo") Then

WinActivate("MetaStock Professional", "Save changes to Layo")

WinWaitActive("MetaStock Professional", "Save changes to Layo")

Send("n")

Sleep(2000)

EndIf

Until WinExists("MetaStock Professional", "Save changes to Layo") = 0

Can you suggest corrections or something better?
Most dialogs like that expect Alt-n, vice just 'n' to answer NO. So the send code would be "!n".

Also, as a matter of personal preference and some improvement in reliablility, I prefer to use window handles as much as possible. So I would try it like this:

WinWait("MetaStock Professional", "Save changes to Layo", 1)
Do
    $hWin = WinGetHandle("MetaStock Professional", "Save changes to Layo")
    WinActivate($hWin)
    WinWaitActive($hWin)
    Send("!n")
    Sleep(2000)
Until WinExists("MetaStock Professional", "Save changes to Layo") = 0

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...