Sign in to follow this  
Followers 0
AbyssUK

detecting a window that isn't detected...

2 posts in this topic

#1 ·  Posted (edited)

HI everybody as you might guess am new to autoit, i am a chemist by trade and programming is not my strong point.. i know some VBA, html/php and now a tiny bit of au3 :P.

Anyway my problem is that for a certain piece of software that runs very long tests i want to be able to send an email once the test has finished. The main window of the software has the title and attributes

CODE
>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Ansicht

Class: LVDChild

Size: X: 0 Y: 0 W: 1280 H: 996

once the test is complete a small windo pops up and displays "Data collected" however the active window info tool doesn't detect the text in the window, it does however change the attributes too.

CODE
>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title:

Class: LVDChild

Size: X: 512 Y: 460 W: 120 H: 55 ; not correct x y h d values

I tried to use WaitActive("") to wait for the untitled window but this would cause the loop to break sporadically.(perhaps due to background processes ?? ) Also the program displays other pop-ups all untitled..

So basically as a quick fix I made my code detect a change in a pixel colour (the pop up window has an icon in the corner), but although this works perfectly for this machine putting the software on any other machine it doesn't really work, because the window changes size/position due to different screen res's, different languages/text etc etc

So basically I was hoping for some help in making my code a bit more generic, but this is the thing the software is very cpu intensive so I cannot do high intensity cpu operations and I need to be as simple as possible. (The software is very bad and will miss data etc if interrupted too much.. so much for multitasking!)

here is my code that works for machines running in 1280x1024

CODE
WinWaitActive("Ansicht") ; wait till main window is clicked on

Do

sleep(600000) ; wait 10 minutes until you check again (saves cpu)

until PixelGetColor(558,461) = 16776960 ;if the pixel x,y changes to the right color test has ended so break loop

Run("c:\mailme.bat") ;calls c:\mailme.bat which has the mapisend command in it (for easy editing of the email address(es))

I'd perfer it if you just pointed me in the right direction instead of doing the coding for me, I am trying to learn :D

Thanks alot.

AbyssUK

Edited by AbyssUK

Share this post


Link to post
Share on other sites



Think i figured out how to do this... first grab the dimensions of the main window.. and as the popup always occurs in the centre of the window i can do a pixel search in the centre! If I detect a pixel with a certain colour break the loop and send a mail !

Not brilliant i admit... instead of pixelsearch is it possible to look for .. say a group of pixels or an icon ?

AbyssUK

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  
Followers 0