Jump to content

Code for clicking ok for a window with a Title


Recommended Posts

I run multiple windows of an application which keeps giving a dialog box. and it has a button OK. i need this ok to be pressed as soon as this dialog appears. anybody can give me the code

for example

"SampleTitle" is the title of that window

 

condition should be.

If only OK button is available on the dialog, click it

if any more or other buttons are visibile, ignore it.

kindly help

Link to comment
Share on other sites

  • Moderators

mansurians, this forum is dedicated to helping folks with their own scripts - it is not a place where we spoon-feed code to you.

If you would like to learn how to accomplish this, begin with looking at articles such as WinExists and WinActive in the help file. The examples in those sections will give you an idea of how to accomplish your task.

Try it out for yourself - and if you get stuck, don't hesitate to come back and post the code you've written (even if it isn't working as you want it to). We will do what we can to help.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Welcome to the AutoIt forum! :)

I'm sorry, but we don't spit code out for you. >_<

Give it a try and come back with a little code and then we can help out :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Sir, I know its a very simple task which am asking you

but its a high priority and urgent for me...

It obviously takes time to learn it.. i am anyway started to learn it.. but i am not much techy guy.. and might take some more time...

 

if not on forum.. atleast mail me that code.. would be so much thankful to you...

Link to comment
Share on other sites

  • Moderators

mansurians - what is high priority and urgent for you is not necessarily so for anyone else. If you are unwilling to put forth this relatively simple effort, no one is likely to be inclined to assist.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Sir, I know its a very simple task which am asking you

but its a high priority and urgent for me...

It obviously takes time to learn it.. i am anyway started to learn it.. but i am not much techy guy.. and might take some more time...

 

if not on forum.. atleast mail me that code.. would be so much thankful to you...

 

Harsh I know, but if you won't put in an effort why should we? 

EDIT: Also, you have left out a great deal of information needed to even make this 'app'. Even if someone was so inclined to give you exactly what you would like, they would be shooting in the dark :(

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

If you would like to learn how to accomplish this, begin with looking at articles such as WinExists and WinActive in the help file. The examples in those sections will give you an idea of how to accomplish your task.

 

JLogan was kind enough to give you references to functions that you will need to use. Search in google for 'WinExists autoit' and you will get the func WinExists helpfile page. That will check if your dialog has popped up, that should be enough info to go on for starters :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

ok

I wrote this code

if (WinActivate("User Message")) Then

    ; Click the "OK" button
    ControlClick("User Message", "OK", "")

EndIf

 

but I need repeatedly to clidk ok... (if once again that comes up also) kindly correct me

 

and one more thing.. when this dialog appearing.. its not showing one more window tab... its coming with in my application..

which means.. only my application tab shows on the bar...

how to control it ?

Link to comment
Share on other sites

Use a

While
...
WEnd
loop to check what exists and put your conditional inside it. Also, instead of if (WinActivate("User Message") Then do this:
If WinExists("User Message") Then

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Also, if your going to use a While loop, you should build a way to exit the script in case it does not have the desired results.

Something like this:

HotkeySet("[ESC]", "Quit") ; will set the escape key to call the quit function
 
While 1
; your code here
WEnd
 
Func Quit() ; function to call when ESC key is pressed
    Exit ; will exit the script
EndFunc

Help any at all? B)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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