Jump to content
Sign in to follow this  
Khoneini

Click no button but Window name is the same

Recommended Posts

Khoneini

All,

I'm having issues with programming a additional script in AutoIT. The problem is that sometimes a Window pops up and I want the script to automaticlly click NO when the Window occurs. The only problem is that I can't filter on Window name. This because the window name of the popup box is the same as the Window name of the main application. Please see the Control dialog of this button below:

>>>> Window <<<<
Title:    Microsoft Dynamics GP
Class:    TNTDLG
Position:    230, 199
Size:    486, 197
Style:    0x94C00000
ExStyle:    0x00000101
Handle:    0x067B0620

>>>> Control <<<<
Class:    Button
Instance:    2
ClassnameNN:    Button2
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:2]
ID:    2
Text:    &No
Position:    260, 132
Size:    80, 24
ControlClick Coords:    49, 12
Style:    0x5000030B
ExStyle:    0x00000000
Handle:    0x040405D0

>>>> Mouse <<<<
Position:    542, 365
Cursor ID:    0
Color:    0xE7E7EF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Yes
&No


>>>> Hidden Text <<<<

Any idea how I can build a check based on above Control information? Any help or directions are greatly appreciated.

Share this post


Link to post
Share on other sites
water

Please have a look at the help file, function WinWait. There are many ways to specify which window you want to wait for. In your case I suggest to use the Class.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khoneini

So, something like this? I want a 10 minute loop from 23:55 till 00:05 to check for this window(it occurs between that time):

$iBegin = TimerInit() ;GET A TIMESTAMP FOR THE LOOP
Do ;START THE LOOP
If WinExists("[TITLE:Microsoft Dynamics GP; CLASS:TNTDLG]") Then ;LOOK FOR THE DIALOG
WinActivate("[TITLE:Microsoft Dynamics GP; CLASS:TNTDLG]") ;ACTIVATE REPORT DESTINATION WINDOW
ControlClick("[TITLE:Microsoft Dynamics GP; CLASS:TNTDLG]", "", "Button2") ;CLICK "CANCEL" Button
$iBegin = TimerInit() ;RESET THE TIMESTAMP SO IT WILL START THE LOOP AGAIN
EndIf
Sleep(10) ;GIVE THE CPU A BREATHER
Until TimerDiff($iBegin) > 600 * 1000 ; EXIT THE LOOP IF WE GO 600 SECS(10 MINUTES) WITHOUT CANCELLING A DIALOG

Credits go to Melba23 for above script in my previous topic but I think it might be a solution for this too. Can someone please verify?

Edited by Khoneini

Share this post


Link to post
Share on other sites
water

Looks good so far.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RogerH

Did you have any luck with this?  I have a very similar problem on automating the client installer to dismiss the "You do not have permission to open this file" dialog box.

Share this post


Link to post
Share on other sites
water

Doesn't the client installer have command line switches so you can do a silent isntall?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.