Jump to content

I want to click the ok button f the message box


 Share

Recommended Posts

Local $p = "Data to be searched"

if stringregexp($p) then msgbox(passed)

if not stringregexp($p) then msgbox(failed)

WinWait("Error")
WinActive("Error")
Sleep(10)
MouseClick('primary', 67, 106, 1, 0)

i tried using mouse control but it os not clicking but it is shifting the pos of the msgbx, plz help

Link to comment
Share on other sites

21 minutes ago, pankajv2 said:

if stringregexp($p) then msgbox(passed)

I'm sorry, but almost everything here is wrong. You should consult the help, in particular the part Parameters.

https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm

https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

25 minutes ago, Musashi said:

I'm sorry, but almost everything here is wrong. You should consult the help, in particular the part Parameters.

https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm

https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm

Local $p = "DataMemory\.hex in DATA MEMORY area  \.\.\.\R< File successfully loaded\.\N*\R" & _
     ".*?DisplayModule\.hex in PROGRAM MEMORY area  \.\.\.\R< File successfully loaded\.\N*\R" & _
     ".*?OTAResetManager\.hex in PROGRAM MEMORY area  \.\.\.\R< File successfully loaded\.\N*\R" & _
    ".*?OTAServiceManager\.hex in PROGRAM MEMORY area  \.\.\.\R< File successfully loaded\.\N*\R"

If StringRegExp($string, $p) Then
    ;MsgBox(0, "Error", "µC programming passed")

If Not StringRegExp($string, $p) Then
    ;MsgBox(0, "Error", "µC programming failed")

WinWait("Error")
WinActive("Error")
Sleep(10)
MouseClick('primary', 67, 106, 1, 0)

Thanks for your comment, but the code we have written above is working. the msg box is appearing with "ok" tab. We do not want to use the time out command to dismiss the msg box. We want to click the "OK" tab. but it is not working by using mouse cursor coordinates. could you please help.

Link to comment
Share on other sites

4 hours ago, pankajv2 said:

Thanks for your comment, but the code we have written above is working.

The code you have written may work, but not the code you have provided here ;).

Error.thumb.png.4585eca67ee8af596433994549e983ca.png

BTW : Are you somehow related to the user @shreya , or is this just a double account of yours?  

see : https://www.autoitscript.com/forum/topic/200717-i-want-to-know-how-can-we-validate-multiple-strings-from-a-file/?do=findComment&comment=1439926

Edited by Musashi
typo

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

7 hours ago, pankajv2 said:

We do not want to use the time out command to dismiss the msg box. We want to click the "OK" tab. but it is not working by using mouse cursor coordinates. could you please help.

Since you provided a non-runable fragment, here just some remarks :

1.

The default API-generated MsgBox from AutoIt pauses the script. It is not possible to continue, unless you response to the MsgBox or use a timeout. The rest of the script ( WinWait("Error") ... ) will not be executed until the MsgBox was closed.

- a possible solution could be (untested) : https://www.autoitscript.com/forum/topic/121609-notifybox-udf/

- also have a look at (untested) : https://www.autoitscript.com/forum/topic/136149-notify-new-version-26-apr-19/

Question : "If you want to click away the message box instantly, why are you displaying it at all?"

2.

If StringRegExp($string, $p) Then
    ;MsgBox(0, "Error", "µC programming passed")

If Not StringRegExp($string, $p) Then
    ;MsgBox(0, "Error", "µC programming failed") 

Should better be written like this :

; Example :
Local $sString = "This is a String"
Local $p       = "This"  ; pattern (just for demo)

If StringRegExp($sString, $p) Then
    MsgBox(0, "Error", "µC programming passed")
Else
    MsgBox(0, "Error", "µC programming failed")
EndIf

Sorry, but without more details, it's hard to help you.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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...