feelie75

Need help with WinWait for a specific sized window[solved]

6 posts in this topic

#1 ·  Posted (edited)

Hi. i googled and searched a lot before posting this. thanks for any help.

I need to locate a window that has no title or discernible text, BUT is always the same size. The autoit documentation says:

"X \ Y \ W \ H - The position and size of a window

One or more properties are used in the title parameter of a window command in the format:

[PROPERTY1 : Value1; PROPERTY2:Value2]"

However, i can't figure out exactly how to do that. i tried:

Local $winAW = WinWait("[W:506;H:288]", "", 30);

That didn't work. I couldn't find an example of the specific format I need to use. Can someone provide a proven working example? Maybe that example can be added to the documentation? :) Thanks!

Edited by feelie75

Share this post


Link to post
Share on other sites



Your WinWait statement looks correct to me. Did you check with the AutoIt Window Info Tool that the window has the size you specify?


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

is the size maybe relative to another program?

Share this post


Link to post
Share on other sites

Please post a screenshot of the AutoIt Window Info Tool for your window.


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

#6 ·  Posted (edited)

Thanks sorry I didn't reply sooner. Here's the screen capture:

 

I can't find it via Class because all of the Spruce POS Windows have the same class of RAIL_WINDOW. And the title is blank :(. So I figured Size would do it. There's no Visible Text when I click on that tab. I tried typing in some text, and it appeared to work at first, but then autoit starting find my AUTOIT script editor Window because it found the text that I was looking for. very meta...

Anyhow, it seems to work when I have JUST that code standalone:

Local $winAW = WinWait("[W:506;H:288]", "", 30);
winActivate($winAW);
msgBox('','Found it','Found window!');

It just seems to fail with my larger script:

Ok.... I figured it out.. Sorry guys. The height of the error window is 269 for the SKU in my script. The random sku I picked to get the window size was 288 :P. I didn't think the height of that error window changed. So far width is consistent though so I'll just use that.

Thanks for making me think and double-check everything, appreciate it!

 

 

 

autoit-winwait1.jpg

Edited by feelie75

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

  • Similar Content

    • ur
      By ur
      if ControlClick("[CLASS:MsiDialogCloseClass]"," ","[CLASS:SysTreeView32; INSTANCE:1]") Then $htreeview=ControlGetHandle($hwnd,"","[CLASS:SysTreeView32; INSTANCE:1]") ControlTreeView($hwnd," ",$htreeview,"Select","#4") The above code worked well to enable the martupgrade feature on windows 7.
      As part of our Installation Testing Automation before delivering the installer to end user.To confirm whether all the screens are working good.

      But it is not working on windows 10.
       
      $h= ControlTreeView($hwnd," ",$htreeview,"Select","#4") The $h is getting value 1,which means error.
    • ur
      By ur
      I have automated an install process by using the below code.
       
      Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc $win1 = "Text 1" $win2 = "Text 2" _WinWaitActivate($win1,"WARNING: This progra") Send("{ALTDOWN}n{ALTUP}");Send("{SPACE}") _WinWaitActivate($win1,"I DISAGREE and &do n") Send("{UP}n") _WinWaitActivate($win1,"Customer Information") Send("{ALTDOWN}n{ALTUP}");Send("{TAB}{TAB}n") _WinWaitActivate($win1,"Click Next to instal") Send("{ALTDOWN}n{ALTUP}");Send("n") _WinWaitActivate($win1,"This feature require") Send("{ALTDOWN}n{ALTUP}");Send("{TAB}n") _WinWaitActivate($win1,"Ready to Install the") Send("{ALTDOWN}i{ALTUP}");Send("i") _WinWaitActivate($win1,"The InstallShield Wi") Send("{ALTDOWN}f{ALTUP}");Send("f") _WinWaitActivate($win2,"You must restart you") Send("{ALTDOWN}n{ALTUP}");Send("n") Now if any new screen comes in the middle of installation, like some VC++ installation error or like that.
      The AutoIT is waiting in the background.
      Is there any way to skip the new screens with just "enter" and continue the installation??
    • TheInfamousOne
      By TheInfamousOne
      I have a small exe I created in AutoIt that seems to be causing some problems in OutLook when people go to save a PDF or Reply to emails.

      Here is my code.
       
      TraySetState(2) WinWait("[CLASS:#32770]", "Make sure that your sign-in address, user name, and password are correct and try again.", 0) WinClose( "Lync")  
      So this works just fine, it closes these message prompts we are trying to suppress.  But if the autoit executable is running when someone is using Outlook and they go to Save as PDF.  When they click "Save As" and go to type in the name of the file to save, they can't type in the box.  So if they close the autoit executable that's running only the code above, then they can use type in the name of the file.  So we know the EXE is preventing users from saving documents.

      Now, I'm sure it could be the way I've written this code, but I'm new to AutoIt and I'm not sure what could be causing this.  This little script seems like it' targeting the correct CLASS # and Window TItle and exact message.  So I don't understand why it's interfering with other applications.

      Any ideas?
    • DeeJay7
      By DeeJay7
      I'm looking possible ways to optimize sleep time in a script which has multiple sleep times for save, refresh etc.
      The sleep duration varies from 5 secs to 17 secs time to time (depending upon the record, computer performance etc).
      Currently I set max sleep duration. ie sleep(17000).
      I'm looking possible ways to dynamically change sleep duration rather than fixed maximum duration.
      Note: winwait is not helpful in my script.
      Thanks in advance for your responses
    • badapple89
      By badapple89
      I basically want to create a Windows 8 Training script for new users, so need a popup to show when they open the start menu.
        WinWait and WinWaitActive are never detecting on my Win8 64 bit computer when waiting for the new start screen window.
      I have used "Start menu" and "[CLASS:ImmersiveLauncher]" for the title, even "[CLASS:DirectUIHWND]"
      Below is the Window info the the Start Screen
      >>>> Window <<<< Title: Start menu Class: ImmersiveLauncher Position: 1920, 0 Size: 1920, 1080 Style: 0x96000000 ExStyle: 0x00200008 Handle: 0x0000000000010190 >>>> Control <<<< Class: DirectUIHWND Instance: 0 ClassnameNN: DirectUIHWND0 Name: Advanced (Class): [CLASS:DirectUIHWND; INSTANCE:0] ID: Text: Position: 0, 0 Size: 1920, 1080 ControlClick Coords: 138, 174 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x0000000000010192 >>>> Mouse <<<< Position: 2058, 174 Cursor ID: 0 Color: 0x180053 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< Explorer Browser Control   I have this setup to run as a test when I press a hotkey:
      $title = WinGetTitle ("[ACTIVE]")
      $state = WinGetState  ($title)
      ConsoleWrite ($title &" "& $state)
      I get "Start menu 0" its always 0 no matter what (it works correctly with other programs)
      I can get the PID of start menu but how can I then check when its active from that?
      Any help appreciated
      EDIT: I can only get the PID, Handle or anything else if the Start window is open. I cannot use win wait with any of this info though.