Jump to content

Click no button but Window name is the same


Recommended Posts

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.

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

Looks good so far.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 months later...

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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