| View previous topic :: View next topic |
| Author |
Message |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Wed Aug 07, 2002 7:56 pm Post subject: What's the best way to close popups? |
|
|
I'm working on a script to close annoying popups that are being generated by a program we use. The popups have the same titles and button names as valuable error messages, so a @winexists(windowname) will not suffice.
Using @wintext(windowname) returns only the title, not any identifying body text. Using @wintext(@winatpoint(xcoord,ycoord)) to locate body text works only if the user's screen resolution is identical to mine and then only if the popup isn't moved.
How can I close only the annoying popup, regardless of its position and regardless of the user's display settings? When the popup occurs while an error message is being displayed, how can I close only the popup when both windows have the same title and button names? |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Aug 07, 2002 11:38 pm Post subject: |
|
|
Have you checked the class name to see if it's different
from the "good" message windows?
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Wed Aug 07, 2002 11:57 pm Post subject: |
|
|
Yup. All class names are the same for popups, be they errors, warnings or nags.
Outside of the body text, the only real variable is the identifier, but, as it's dynamic, it's of no use to block the unwanted popups.
I don't know if the author was lazy for giving all alerts the same names or brilliant for the same reason. |
|
| Back to top |
|
 |
Que Valued Newbie

Joined: 25 Aug 2001 Posts: 38 Location: Newaygo, MICH
|
Posted: Thu Aug 08, 2002 12:14 pm Post subject: |
|
|
You indicated that you couldn't use @winatpoint because of varying screen resolutions. The x,y position of the popup IS relative to screen resolution, however, pixel size of the popup does not change with screen resolution.
So... if you use Window Position, %%winname,0,0 to locate the popups to the upper left corner of the screen, any identifying marks should be located at the same x,y, regardless of screen size.  _________________ Que |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Thu Aug 08, 2002 1:57 pm Post subject: |
|
|
Good suggestion, but I reached the text X/Y numbers via Window Spy, so they are based on 0/0 already.
I suppose a solution to my problem can be reached by reading the body text relative to the popup X/Y position. In other words, once the X/Y of the popup is determined (easy enough), read the body text at position X/Y from the upper left corner of the popup. But how do I determine the X/Y of the body text? |
|
| Back to top |
|
 |
Que Valued Newbie

Joined: 25 Aug 2001 Posts: 38 Location: Newaygo, MICH
|
Posted: Thu Aug 08, 2002 3:37 pm Post subject: |
|
|
Not sure if this will help. But I used the following script to scan windows pixel by pixel (actually use 4x4 blocks). Just use your window identifiyer and change the output file name. For every element on the window, it dumps the dynmic identifyer (@winatpoint) the text associated with that element (@wintext(@winatpoint) ) and the x,y for that element. Since it scans every 4 pixels, you actually end up with a range of x,y coords for each element. Perhaps this will help you identify the location of the body text you're looking for. Without more detailed infomation, I'm not sure how much more help I can be. Anyway... here it is:
| Code: |
Title Window Examiner
DIALOG CREATE,Window Examiner,-1,0,412,60
DIALOG ADD,BUTTON,go,2,152,64,24,go
DIALOG ADD,status,sb1
DIALOG SHOW
%%winname = your window name
:Evloop
wait event
goto @event()
:goBUTTON
list create,1
list add,1,"WinatPoint,WinText,X,Y"
window position,%%winname,0,0
PARSE "%W;%H",@winpos(%%winname,WH)
%%wid = 0
%%ht = 0
repeat
repeat
%%Txt = @wintext(@winatpoint(%%wid,%%ht))
%%txt2 = @winatpoint(%%wid,%%ht)
dialog set,sb1,Window is %W x %H. Processing %%wid x %%ht
list add,1,%%txt2","%%txt "," %%wid "," %%ht
%%wid = @sum(%%wid,4)
until @greater(%%wid,%W)
%%wid = 0
%%ht = @sum(%%ht,4)
until @greater(%%ht,%H)
list savefile,1,c:\windows\desktop\windowinfo.csv
list close,1
goto evloop
:Close
exit
|
_________________ Que |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Thu Aug 08, 2002 4:31 pm Post subject: |
|
|
Wow. That's quite a bit of work on my behalf and I thank you for it.
I don't mean to be disrespectful but I might have come up with a solution other than yours: As the text position is absolute to the popup position, all I need to do is locate the X/Y of the text relative to the popup.
Let's say the popup X/Y on my PC is 500/300 and the X/Y of the text is 550/350. That would mean the text is at 50/50 relative to the popup, regardless of the popup's position on the screen. By adding these values to the X/Y of the popup on other displays, it should point to the text position, which I can then inspect. Sound good? |
|
| Back to top |
|
 |
Que Valued Newbie

Joined: 25 Aug 2001 Posts: 38 Location: Newaygo, MICH
|
Posted: Thu Aug 08, 2002 5:16 pm Post subject: |
|
|
No trouble, I already had that script done, I just took my window name and path out of it.
As far as the x,y coords being relative to the popup location... that is what I was indicating in my previous post. Relocating the popup to 0,0 just simplifies things.
As you indicated, you could use:
| Code: |
parse "%%top;%%lft",@winpos(window,TL)
%x = @sum(%%lft,50)
%y = @sum(%%top,50)
%%text = @wintext(@winatpoint(%x,%y))
|
I suggested:
| Code: |
window position,window,0,0
%%text = @wintext(@winatpoint(50,50)
|
Like I said, it's just a little easier to understand. _________________ Que |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Aug 08, 2002 10:53 pm Post subject: |
|
|
The spy tool code I posted here:
http://www.vdsworld.com/forum/viewtopic.php?t=450
Shows the mouse position in both screen XY and
window XY, and also shows the text at the mouse
position, as well as the class of the element...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Que Valued Newbie

Joined: 25 Aug 2001 Posts: 38 Location: Newaygo, MICH
|
Posted: Fri Aug 09, 2002 12:38 pm Post subject: |
|
|
Elegance is not my strong point. My QD script got the job done, but Mac your spytool is much more convenient.
Thanks! _________________ Que |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Aug 09, 2002 1:00 pm Post subject: |
|
|
Glad ya like it...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Fri Aug 09, 2002 8:14 pm Post subject: |
|
|
Quickly getting back to Que ...
I had to go with my own solution. All popups from the target program, even desirable ones, have the same title. I couldn't move 'em to 0/0 without disrupting the users' experience. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|