forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Window Spy Tool (realtime)...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Jul 27, 2002 2:58 pm    Post subject: Window Spy Tool (realtime)... Reply with quote

This is a simple window spy tool that shows info
based on the mouse XY position.

It's not necessary to click other windows, just hold
the cursor over the window or control you want
info from.

When spying, the program allows you three
seconds to do stuff once you click on another
app, then it self-activates again (it needs to be
the active window for hotkeys). If minimized
during this wait period, it reactivates when the
three seconds are up. It stays "ontop" unless
iconized, then it automatically stops spying.

You stop spying with the "S" hotkey (while you're
holding the mouse over a specific window/control).
Then you can copy the displayed info with Cntrl+C
(or select and paste from the individual edit boxes).
You restart spying with the "R" hotkey.

It shows the following information for windows and
controls (if available):
Text at mouseXY.
Class name.
Handle.
Parent handle.
Window status (normal or maximized - when held
over an iconized window it shows taskbar info).
Top and left window positions, width and height.
Mouse position screenXY.
Mouse position windowXY.

There's also a status bar with info on stop, restart
and copy, depending on which mode it's in.
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Mac's Window Spy Tool",-1,0,350,185,CLASS "MacSpyToolApp",ONTOP
  DIALOG ADD,STYLE,S1,MS Sans Serif,8,B,BACKGRND
  DIALOG ADD,MENU,&Hotkeys,&Stop|S,&Restart|R,-,&Copy Info|Ctrl+C,-,&Exit|Alt+X
  DIALOG ADD,EDIT,E1,0,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E2,20,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E3,40,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E4,60,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E5,80,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E6,100,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E7,120,0,350,20,,,READONLY,S1
  DIALOG ADD,EDIT,E8,140,0,350,20,,,READONLY,S1
  DIALOG ADD,STATUS,Stat,"",S1
DIALOG SHOW

LIST CREATE, 1
GOSUB LoadList1

:RestartMENU
  DIALOG SET, Stat, "Spying. Press 'S' to stop..."
  REPEAT
    WAIT ".1"
    rem -- Make sure Spy Tool is NOT iconized --
    if @equal(@winpos("Mac's Window Spy Tool", S), 1)
       if @not(@equal(@winactive(), "Mac's Window Spy Tool"))
          rem -- Allow user three seconds for other program actions --
          DIALOG SET, Stat, "Stopped. 3 seconds to start..."
          WAIT
          DIALOG SET, Stat, "Stopped. 2 seconds to start..."
          WAIT
          DIALOG SET, Stat, "Stopped. 1 second to start..."
          WAIT
          rem -- Keep Spy Tool active for hotkey usage --
          WINDOW ACTIVATE, "Mac's Window Spy Tool"
          DIALOG SET, Stat, "Spying. Press 'S' to stop..."
       end
       %e = @event()
    else
       rem -- If Spy Tool is iconized, deactivate --
       %e = StopMENU
    end
    PARSE "%x;%y", @mousepos()
    PARSE "%t;%l;%w;%h;%s", @winpos(@winatpoint(%x,%y),TLWHS)
    DIALOG SET, E1, "Text at MouseXY = "@wintext(@winatpoint(%x,%y))
    DIALOG SET, E2, "Class = "@winclass(@winatpoint(%x,%y))
    DIALOG SET, E3, "Handle = "@winatpoint(%x,%y)
    DIALOG SET, E4, "Parent Handle = "@window(@winatpoint(%x,%y),OWNER)
    DIALOG SET, E5, "Window Status = "@item(1, %s)
    DIALOG SET, E6, "Top = "%t"   Left = "%l"   Width = "%w"   Height = "%h
    DIALOG SET, E7, "Mouse ScreenX = "%x"   Mouse ScreenY = "%y
    DIALOG SET, E8, "Mouse WindowX = "@diff(%x,%l)"   Mouse WindowY = "@diff(%y,%t)
  UNTIL %e
  goto %e

:StopMENU
:EVLOOP
  DIALOG SET, Stat, "Stopped. Press 'R' to restart, or Ctrl+C to copy info..."
  WAIT EVENT
  goto @event()

:Copy InfoMENU
  LIST CLEAR, 1
  LIST ADD, 1, @dlgtext(E1)
  LIST ADD, 1, @dlgtext(E2)
  LIST ADD, 1, @dlgtext(E3)
  LIST ADD, 1, @dlgtext(E4)
  LIST ADD, 1, @dlgtext(E5)
  LIST ADD, 1, @dlgtext(E6)
  LIST ADD, 1, @dlgtext(E7)
  LIST ADD, 1, @dlgtext(E8)
  LIST COPY, 1
  GOSUB LoadList1
  goto EVLOOP

:ExitMENU
:CLOSE
  EXIT

rem ----------------- GOSUB -----------------

:LoadList1
  LIST CLEAR, 1
  LIST ADD, 1, ""
  LIST ADD, 1, "Normal"
  LIST ADD, 1, "Iconized"
  LIST ADD, 1, "Maximized"
  exit

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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Jul 27, 2002 3:10 pm    Post subject: Reply with quote

The explenation is even larger then the source code itself!!! Smile
But, it works well...
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Jul 27, 2002 3:29 pm    Post subject: Reply with quote

Lol, the explanation is kinda long. I just didn't want
anybody thinkin' the "features" were "bugs"... Wink

Actually I was gonna make a popup killer and wound
up with this instead. Guess I got a little side-tracked... Confused

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Jul 27, 2002 5:04 pm    Post subject: Reply with quote

I would like to see a popup killer in VDS myself. My attempt at one
wasn't so hot and I haven't the time to go back and do a better job
on it.

-Garrett
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Jul 27, 2002 5:32 pm    Post subject: Reply with quote

Yes, I would too, I agree with Garrett...
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1752
Location: Space and Time

PostPosted: Sat Jul 27, 2002 8:30 pm    Post subject: Reply with quote

I have made one long ago that worked very well. I made it on
VDS 3. I may update it. It also can resize almost any window.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Jul 27, 2002 9:50 pm    Post subject: Reply with quote

Well, I use the "Window Auto Position" program that I
posted a while back

http://www.vdsworld.com/forum/viewtopic.php?t=56

to keep all my browser windows the same size. Since it
checks each active browser window anyway (prolly have
to change that to check all browser windows), I was just
gonna check for the IE toolbar control (not sure about
Netscape yet). Popup ads don't usually have a toolbar,
and if it don't have one I was gonna auto-close it. May
not be 100% effective but should be pretty close.

Then I got to playin' with obtaining the class, handle, etc.
and wound up with the spy tool. I'll prolly do the popup
in the next day or so. Not exactly hittin' on all cylinders
today after bein' up all night with just a nap this afternoon.
ZZZzzzZZZzzz... Confused

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Jul 28, 2002 1:09 am    Post subject: Reply with quote

With my popup killer, I used the title bar text of the popup. It was
running with my cookie killer and the program sat in the tray. If you
get a popup, you make it the active window, then press SHIFT+ALT+P
and it will record the title bar text and if it sees that window again, it
will just automatically kill it.

Source code is available if you need it.

http://www.vdsworld.com/index.php?page=download&fileid=152

It may be a little barbaric, but I'm still using this program to date to
kill cookies and popups.


-Garrett
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Aug 10, 2002 2:11 am    Post subject: Reply with quote

Here's another version of the Spy Tool. It now can
scan all visible control handles and classes from a
chosen window (similiar to VDS Window Spy), except
for disabled controls (they're invisible to VDS).

If you choose to scan for all child controls, allow 15
seconds or so on large windows. It scans along every
single Y line in 5 pixel increments. It's also much faster
when compiled.

Also added a help info window.
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE "Mac's Window Spy Tool"
DIALOG CREATE,"Mac's Window Spy Tool",-1,0,400,240,CLASS "MacSpyToolApp",ONTOP
  DIALOG ADD,STYLE,S1,,,,BACKGRND
  DIALOG ADD,STYLE,S2,MS Sans Serif,8,B,BACKGRND
  DIALOG ADD,MENU,&Actions,&Stop|S,&Restart|R,-,&Copy Info|Ctrl+C,-,&Exit|Alt+X
  DIALOG ADD,MENU,&Help,&Help
  DIALOG ADD,EDIT,E1,0,0,400,20,,,READONLY,S1
  DIALOG ADD,EDIT,E2,20,0,400,20,,,READONLY,S1
  DIALOG ADD,EDIT,E3,40,0,400,20,,,READONLY,S1
  DIALOG ADD,EDIT,E4,60,0,400,20,,,READONLY,S1
  DIALOG ADD,EDIT,E5,80,0,400,20,,,READONLY,S1
  DIALOG ADD,BUTTON,B1,101,100,200,20,"Get More Information",,S2
  DIALOG ADD,LIST,L1,120,0,400,100
  DIALOG ADD,STATUS,Stat,"",S2
DIALOG SHOW
rem -- Add horizontal scroll to list --
%z = @sendmsg(@winexists(~L1),$0194,2000,0)

LIST CREATE, 1
LIST ADD, 1, ""
LIST ADD, 1, "Normal"
LIST ADD, 1, "Iconized"
LIST ADD, 1, "Maximized"
goto RestartMENU

:EVLOOP
  WAIT EVENT
  goto @event()

:RestartMENU
  DIALOG SET, Stat, "Spying (mouse XY) - Press 'S' to stop..."
  REPEAT
    WAIT ".01"
    rem -- Make sure Spy Tool is NOT iconized --
    if @not(@equal(@winpos("Mac's Window Spy Tool", S), 2))
       if @not(@equal(@winactive(), "Mac's Window Spy Tool"))
          rem -- Allow user three seconds for other program actions --
          DIALOG SET, Stat, "Stopped. 3 seconds to start..."
          WAIT
          DIALOG SET, Stat, "Stopped. 2 seconds to start..."
          WAIT
          DIALOG SET, Stat, "Stopped. 1 second to start..."
          WAIT
          rem -- Keep Spy Tool active for hotkey usage --
          WINDOW ACTIVATE, "Mac's Window Spy Tool"
          DIALOG SET, Stat, "Spying (mouse XY) - Press 'S' to stop..."
       end
       %e = @event()
    else
       rem -- If Spy Tool is iconized, deactivate --
       %e = StopMENU
    end
    PARSE "%x;%y", @mousepos()
    %%target = @winatpoint(%x,%y)
    PARSE "%t;%l;%w;%h;%s", @winpos(%%target,TLWHS)
    DIALOG SET, E1, "Text at MouseXY= "@wintext(%%target)
    DIALOG SET, E2, "Handle= "%%target"   Class= "@winclass(%%target)"   Status= "@item(1, %s)
    DIALOG SET, E3, "Parent Handle= "@window(%%target,OWNER)"   Parent Class= "@winclass(@window(%%target,OWNER))
    DIALOG SET, E4, "Top= "%t"   Left= "%l"   Width= "%w"   Height= "%h
    DIALOG SET, E5, "Mouse: ScreenX= "%x"   ScreenY= "%y"   WindowX= "@diff(%x,%l)"   WindowY= "@diff(%y,%t)
  UNTIL %e
  goto %e

:B1BUTTON
  %s = "Click window to scan "
  REPEAT
    DIALOG SET, Stat, %s
    GOSUB Display
    %e = @event()
  UNTIL @not(@equal(@winactive(),"Mac's Window Spy Tool"))@equal(%e, "CLOSE")
  %%target = @winactive()
  if @equal(%e, "CLOSE")
     goto %e
  end
  WINDOW ICONIZE,"Mac's Window Spy Tool"
  WAIT ".5"
  WINDOW ACTIVATE, %%target
  WAIT ".5"
  PARSE "%t;%l;%w;%h;%s", @winpos(%%target,TLWHS)
  WAIT ".5"
  rem -- If window position is off screen --
  if @greater(0, %t)@greater(0, %l)@greater(%w, @sysinfo(SCREENWIDTH))@greater(%h, @sysinfo(SCREENHEIGHT))
     WINDOW NORMAL,"Mac's Window Spy Tool"
     %s = "Reposition the target window:"@cr()@cr()
     %s = %s@chr(34)%%target@chr(34)@tab()@cr()@cr()
     %s = %s"Current position:"@cr()
     %s = %s"Top= "%t"   Left= "%l"   Width= "%w"   Height= "%h@tab()@cr()@cr()
     %s = %s"Spy Tool cannot scan off screen..."
     WARN %s
     %s = ""
     goto EVLOOP
  end
  LIST CREATE, 2, SORTED
  DIALOG SET, E1, "Window Title= "%%target
  %%target = @winatpoint(%l,%t)
  DIALOG SET, E2, "Handle= "@winatpoint(%l,%t)"   Class= "@winclass(%%target)"   Status= "@item(1, %s)
  DIALOG SET, E3, "Parent Handle= "@window(%%target,OWNER)"   Parent Class= "@winclass(@window(%%target,OWNER))
  DIALOG SET, E4, "Top= "%t"   Left= "%l"   Width= "%w"   Height= "%h
  DIALOG CLEAR, E5
  %x = %l
  %y = @succ(%t)
  %z = @pred(@sum(%t, %h))
  %w = @diff(%w, 4)
  REPEAT
    REPEAT
      if @greater(%w, %x)
         %x = @sum(%x, 5)
      else
         %x = %l
      end
      %%target = @winatpoint(%x,%y)
      LIST ADD, 2, "Handle= "%%target"   Class= "@winclass(%%target)
    UNTIL @equal(%x, %l)
    %y = @succ(%y)
  UNTIL @equal(%y, %z)@greater(%y, %z)
  WINDOW NORMAL,"Mac's Window Spy Tool"
  LIST ASSIGN, L1, 2
  LIST CLOSE, 2
  DIALOG SET, Stat, "Scan complete - "@count(L1) items (excludes disabled controls)"
  goto EVLOOP

:StopMENU
  DIALOG SET, Stat, "Stopped. Press 'R' to restart, or Ctrl+C to copy info..."
  goto EVLOOP

:Copy InfoMENU
  LIST CREATE, 2
  LIST ADD, 2, @dlgtext(E1)
  LIST ADD, 2, @dlgtext(E2)
  LIST ADD, 2, @dlgtext(E3)
  LIST ADD, 2, @dlgtext(E4)
  LIST ADD, 2, @dlgtext(E5)
  if @greater(@count(L1), 0)
     %x = 0
     REPEAT
       LIST ADD, 2, @item(L1, %x)
       %x = @succ(%x)
     UNTIL @equal(%x, @count(L1))
  end
  LIST COPY, 2
  LIST CLOSE, 2
  goto EVLOOP

:HelpMENU
  %s = "TO SPY 'REALTIME'"@cr()
  %s = %s"- Press 'S' to stop program and capture mouse XY info."@cr()
  %s = %s"- Press 'Ctrl+C' to copy info (including list) to clipboard."@cr()
  %s = %s"- Press 'R' to restart 'Realtime' mouse XY spying."@cr()@cr()@cr()
  %s = %s"'GET MORE INFORMATION' BUTTON"@cr()
  %s = %s"- Press 'Get More Information' button."@cr()
  %s = %s"- Click a window (not Spy Tool) to scan all its' controls."@cr()
  %s = %s"- Spy Tool minimizes itself and scans the chosen window,"@tab()@cr()
  %s = %s"  then returns to normal size when it's finished."@cr()
  %s = %s"- Press 'Ctrl+C' to copy info (including list) to clipboard."@cr()
  %s = %s"- You can restart the 'Realtime' spy mode again to find"@cr()
  %s = %s"  actual location of an item while it's in list if needed."@cr()@cr()@cr()
  %s = %s"NOTES"@cr()
  %s = %s"- For accurate results do NOT do anything until scan"@cr()
  %s = %s"  has completed (this may take a few moments)."@cr()
  %s = %s"- Window to be scanned must be fully on screen, and"@cr()
  %s = %s"  sized so that all controls are visible."@cr()
  %s = %s"- Spy Tool CANNOT scan disabled controls."@cr()@cr()
  INFO %s
  %s = ""
  goto EVLOOP

:ExitMENU
:CLOSE
  EXIT

rem ----------------- GOSUB -----------------

:Display
  if @greater(40, @len(%s))
     %s = %s"?"
  else
     %s = "Click window to scan "
  end
  WAIT ".01"
  exit

[EDIT1] Major Bug Fix - Now adds window "height" to window "top"
position for end of Y scan.

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
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sun Aug 11, 2002 4:46 am    Post subject: Reply with quote

Oops... Embarassed

Just found/fixed a major bug. Scan procedure now adds
window "height" to window "top" for end of Y scan position.

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group