Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 04:31:52 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FindFocus  (Read 2389 times)

CrawlerBrinx

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
FindFocus
« on: October 08, 2012, 12:58:49 PM »
I've just discovered FindFocus
code
;FindFocus.ahk
; Find focused control
;Skrommel @2006

FileInstall,f1.gif,f1.gif
FileInstall,f2.gif,f2.gif

#SingleInstance,Force
#NoEnv
SetBatchLines,-1

applicationname=FindFocus

Gosub,TRAYMENU

found=0

START:
x1=0
y1=-1
WinGetPos,wx,wy,ww,wh,A
If found=1
{
  ToolTip,F,% x2-10,% y2-20
  Sleep,50
  ToolTip,F,% x2-5,% y2-20
  Sleep,50
}
Else
{
  x2:=-1
  y2:=20
}
ToolTip,F,% x2,% y2-20
Sleep,100

LOOP:
  Sleep,10
  found=0
  ImageSearch,x1,y1,0,% y1+1,% ww,% wh,*100 f1.gif
  If ErrorLevel=0
  {
    PixelGetColor,rgb1,% x1,% y1,RGB
    PixelGetColor,rgb2,% x1,% y1+1,RGB
    If (rgb1+rgb2=0xffffff)
{
    ImageSearch,x2,y2,% x1-1,% y1-1,% x1+6,% y1+2,*100 f2.gif
    If ErrorLevel=0
    {
      PixelGetColor,rgb1,% x2,% y2,RGB
      PixelGetColor,rgb2,% x2+1,% y2,RGB
      If (rgb1+rgb2=0xffffff)
        found=1
      Goto,START
    }
}
  }
  Else
  {
    found=0
    Goto,START
  }
Goto,LOOP


TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,%applicationname%,ABOUT
Menu,Tray,Add
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Default,%applicationname%
Menu,Tray,Tip,%applicationname%
Return


ABOUT:
Gui,99:Destroy
Gui,99:Margin,20,20
Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
Gui,99:Font,Bold
Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
Gui,99:Font
Gui,99:Add,Text,y+10,Find the focused control in browsers
Gui,99:Add,Text,y+10,- Shows a flashing icon next to the focused control
Gui,99:Add,Text,y+10,- Not perfect, but better than nothing

Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
Gui,99:Font,Bold
Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
Gui,99:Font
Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
Gui,99:Font,CBlue Underline
Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
Gui,99:Font

Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
Gui,99:Font,Bold
Gui,99:Add,Text,x+10 yp+10,DonationCoder
Gui,99:Font
Gui,99:Add,Text,y+10,Please support the contributors at
Gui,99:Font,CBlue Underline
Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
Gui,99:Font

Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
Gui,99:Font,Bold
Gui,99:Add,Text,x+10 yp+10,AutoHotkey
Gui,99:Font
Gui,99:Add,Text,y+10,This tool was made using the powerful
Gui,99:Font,CBlue Underline
Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
Gui,99:Font

Gui,99:Show,,%applicationname% About
hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
OnMessage(0x200,"WM_MOUSEMOVE")
Return

1HOURSOFTWARE:
  Run,http://www.1hoursoftware.com,,UseErrorLevel
Return

DONATIONCODER:
  Run,http://www.donationcoder.com,,UseErrorLevel
Return

AUTOHOTKEY:
  Run,http://www.autohotkey.com,,UseErrorLevel
Return

99GuiClose:
  Gui,99:Destroy
  OnMessage(0x200,"")
  DllCall("DestroyCursor","Uint",hCur)
Return

WM_MOUSEMOVE(wParam,lParam)
{
  Global hCurs
  MouseGetPos,,,,ctrl
  If ctrl in Static9,Static13,Static17
    DllCall("SetCursor","UInt",hCurs)
  Return
}
Return


EXIT:
ExitApp

However, I either don't understand how it works or it simply doesn't work for me.
Instead of getting a blinking [f] icon (as shown in the screenshot below):

I get a non-blinking [f] icon at top left corner (thus it's overlaying favicon) of the active window, which is not useful at all.
Could someone tell me what do I do wrong?
Tried on Win7sp1x64 and WinXPsp3x32

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,790
    • View Profile
    • Donate to Member
Re: FindFocus
« Reply #1 on: October 08, 2012, 01:16:05 PM »
2 questions:
- What browser?

- Why are you resurrecting all these old, old, old, threads? Skrommel has left the building some years ago.

CrawlerBrinx

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
Re: FindFocus
« Reply #2 on: October 08, 2012, 01:31:07 PM »
- Mozilla Firefox.

- This is a new thread. My request is written for a software that still works. And it doesn't matter much for me whether it's author is present/absent/alive or even dead. That's the power of open source software.
First of all I post feature requests/bug reports in order to get help from others. If I won't get that help - most probably I will have to help myself with my own hands. And that's a less pleasant, but still an acceptable scenario.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,790
    • View Profile
    • Donate to Member
Re: FindFocus
« Reply #3 on: October 08, 2012, 03:05:35 PM »
- Mozilla Firefox.
Firefox is known to have 'un-fixed' it's Windows presentation ever since version 5. A lot of tools that manipulate application windows in some way are unable to work with Firefox since that version. Probably the Skrommel tools, built back in the Windows XP and (start of) Vista era, can't cope with these issues.

For most of Skrommel's tools the source is available, you could adjust it to your needs, but seeing that hardly anybody has done this previously, there hasn't been much need for it...