Topics - CrawlerBrinx [ switch to compact view ]

Pages: [1]
1
Skrommel's Software / FindFocus
« on: October 08, 2012, 12:58 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,https://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

2
Skrommel's Software / DropCommand
« on: October 08, 2012, 12:48 PM »
Hey, I just discovered DropCommand
code
;DropCommand.ahk
; Enables drag and drop of files to a command window in Vista
;Skrommel @ 2008

FileInstall,DropCommand.wav,DropCommand.wav

#SingleInstance,Force
#NoEnv
SetWinDelay,0
SetControlDelay,0
CoordMode,Mouse,Screen
DetectHiddenWindows,on
SetBatchLines,-1

showtooltip=1
playsound=1

applicationname=DropCommand
Gosub,TRAYMENU

Gui,+E0x10 +LastFound +AlwaysOnTop -Caption
gui:=WinExist()
Gui,Show,W3 H3
WinHide,ahk_id %gui%
WinSet,Transparent,1,ahk_id %gui%
Return


MOVE:
MouseGetPos,mx2,my2,mwin
WinGetClass,class,ahk_id %mwin%
If class Not In ConsoleWindowClass
  Return
WinMove,ahk_id %gui%,,% mx2-1,% my2-1
WinSet,AlwaysOnTop,On,ahk_id %gui%
WinShow,ahk_id %gui%
Return


~$LButton::
MouseGetPos,mx1,my1,mwin
WinGetClass,class,ahk_id %mwin%
If class In ConsoleWindowClass
{
  WinHide,ahk_id %gui%
  Return
}
down=1
SetTimer,MOVE,100
Return


~$LButton Up::
If down<>1
  Return
down=0
SetTimer,MOVE,Off
SetTimer,HIDE,-100
Return


;By Sean at http://www.autohotkey.com/forum/topic16849.html
GuiDropFiles:
WinHide,ahk_id %gui%
If showtooltip=1
  ToolTip,%A_GuiEvent%
clip:=ClipboardAll
Loop,Parse,A_GuiEvent,`n
{
  If A_LoopField=
    Continue
  IfInString,A_LoopField,%A_Space%
    ClipBoard:="""" A_LoopField """" A_Space
  Else
    ClipBoard:=A_LoopField . A_Space
  ClipWait,1
  nIndex0 := 7   ; 0-based index of the SubMenu in SysMenu
  nIndex1 := 2   ; 0-based index of the item in the SubMenu
  MouseGetPos,,,hWnd
  hSysMenu := DllCall("GetSystemMenu", "Uint", hWnd, "int", False)
  ; nID := DllCall("GetMenuItemID", "Uint", hSysMenu, "int", nIndex0) ; produce -1 for a SubMenu item
  hSubMenu := DllCall("GetSubMenu", "Uint", hSysMenu, "int", nIndex0)
  nID := DllCall("GetMenuItemID", "Uint", hSubMenu, "int", nIndex1)
  PostMessage,0x112,nID,0,,ahk_id %hWnd%   ; WM_SYSCOMMAND
  If playsound=1
    SoundPlay,%applicationname%.wav
  Sleep,100
}
Clipboard:=clip
Clip:=
SetTimer,TOOLTIPOFF,-1000
Return


TOOLTIPOFF:
ToolTip,
Return


HIDE:
WinHide,ahk_id %gui%
Return


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


EXIT:
ExitApp


ABOUT:
Gui,2:Destroy
Gui,2:Add,Picture,Icon1,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,%applicationname% v1.0
Gui,2:Font
Gui,2:Add,Text,xm,Enables drag and drop of files to a command window in Vista
Gui,2:Add,Text,y+0,`t

Gui,2:Add,Picture,xm Icon2,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
Gui,2:Font
Gui,2:Add,Text,xm,For more tools, information and donations, visit
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,xm G1HOURSOFTWARE,www.1HourSoftware.com
Gui,2:Font
Gui,2:Add,Text,y+0,`t

Gui,2:Add,Picture,xm Icon5,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,DonationCoder
Gui,2:Font
Gui,2:Add,Text,xm,Please support the DonationCoder community
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,xm GDONATIONCODER,www.DonationCoder.com
Gui,2:Font
Gui,2:Add,Text,y+0,`t

Gui,2:Add,Picture,xm Icon6,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,AutoHotkey
Gui,2:Font
Gui,2:Add,Text,xm,This program was made using AutoHotkey
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,xm GAUTOHOTKEY,www.AutoHotkey.com
Gui,2:Font
Gui,2:Add,Text,y+0,`t
Gui,2:Add,Text,y+0,`t

Gui,2:Font,Bold
Gui,2:Add,Text,xm yp+10,FreeSoundFiles
Gui,2:Font
Gui,2:Add,Text,xm,Sound file from
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,xm GFREESOUNDFILES,www.FreeSoundFiles.tintagel.net
Gui,2:Font
Gui,2:Add,Text,y+0,`t

Gui,2:Add,Button,GABOUTOK Default w75,&OK
Gui,2: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,https://www.donationcoder.com,,UseErrorLevel
Return

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

FREESOUNDFILES:
Run,http://www.freesoundfiles.tintagel.net
Return

ABOUTOK:
Gui,2:Destroy
OnMessage(0x200,"")
DllCall("DestroyCursor","Uint",hCurs)
Return

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



Since this util adds it's own icon to the tray - why not make it useful?
I think it would be nice if double clicking it would open CMD window and dropping a file to the trayicon would do the same + paste the file's path.

3
Skrommel's Software / GoneIn60s
« on: October 08, 2012, 12:42 PM »
Hi.
I just discovered GoneIn60s
Code
;GoneIn60s.ahk
; Recover closed applications
;Skrommel @ 2006

#NoEnv
#SingleInstance,Force

OnExit,EXIT

CoordMode,Mouse,Screen
CoordMode,ToolTip,Screen

SysGet,SM_CYCAPTION,4
SysGet,SM_CXBORDER,5
SysGet,SM_CYBORDER,6
SysGet,SM_CXEDGE,45
SysGet,SM_CYEDGE,46
SysGet,SM_CXFIXEDFRAME,7
SysGet,SM_CYFIXEDFRAME,8
SysGet,SM_CXSIZEFRAME,32
SysGet,SM_CYSIZEFRAME,33
SysGet,SM_CXSIZE,30
SysGet,SM_CYSIZE,31

applicationname=GoneIn60s

Gosub,INIREAD

inside=0

Gosub,TRAYMENU
SetTimer,CHECK,1000

Loop
{
  Sleep,100
  MouseGetPos,mx,my,win1
  parent:=DllCall("GetParent","uint",win1)
  If parent>0
    Continue
  WinGetPos,x,y,w,h,ahk_id %win1%
  l:=x+w-SM_CXSIZEFRAME-SM_CXSIZE
  t:=y+SM_CYSIZEFRAME
  r:=x+w-SM_CXSIZEFRAME
  b:=y+SM_CYSIZEFRAME+SM_CYSIZE
  If (mx<l Or mx>r Or my<t Or my>b)
  {
    If inside=1
    {
      ToolTip,
      Hotkey,LButton,CLICK,Off
      inside=0
    }
  }
  Else
  {
    If inside=0
    {
      WinGet,program,ProcessName,ahk_id %win1%
      If program In %ignore%
        Continue
      WinGetClass,class,ahk_id %win1%
      If class In %nonwindows%
        Continue
      ToolTip,Gone in %timeout% seconds
      Hotkey,LButton,CLICK,On
      inside=1
    }
  }
}


!F4::
WinGet,win1,Id,A
parent:=DllCall("GetParent",UInt,win1)
If parent>0
  Return
WinGetClass,class,ahk_id %win1%
If class In %nonwindows%
  Return

CLICK:
WinHide,ahk_id %win1%
IfNotInString,closing,%win1%
{
  closing=%closing%%win1%-%A_TickCount%|
  Gosub,TRAYMENU
}
Return


CHECK:
StringSplit,part_,closing,|
Loop,% part_0-1
{
  StringSplit,info_,part_%A_Index%,-
  IfWinExist,ahk_id %info_1%
  {
    left:=Ceil((info_2+timeout*1000-A_TickCount)/1000)
    TrayTip,%applicationname%,Recovered with %left% seconds left!
    StringReplace,closing,closing,%info_1%-%info_2%|
    Gosub,TRAYMENU
  }
  Else
  If (A_TickCount>=info_2+timeout*1000)
  {
    DetectHiddenWindows,On
    If kill=1
    {
      WinGet,pid,Pid,ahk_id %info_1%
      Process,Close,%pid%
    }
    Else
      WinClose,ahk_id %info_1%
    DetectHiddenWindows,Off
    Sleep,1000
    WinShow,ahk_id %info_1%
    StringReplace,closing,closing,%info_1%-%info_2%|
    Gosub,TRAYMENU
  }
 }
Return


RECOVER:
menuitem:=A_ThisMenuItemPos-4
StringSplit,part_,closing,|
StringSplit,info_,part_%menuitem%,-
WinShow,ahk_id %info_1%
Return


RECOVERALL:
StringSplit,part_,closing,|
Loop,% part_0-1
{
  StringSplit,info_,part_%A_Index%,-
  WinShow,ahk_id %info_1%
}
Return


CLOSEALL:
StringSplit,part_,closing,|
Loop,% part_0-1
{
  StringSplit,info_,part_%A_Index%,-
  DetectHiddenWindows,On
  If kill=1
  {
    WinGet,pid,Pid,ahk_id %info_1%
    Process,Close,%pid%
  }
  Else
    WinClose,ahk_id %info_1%
  DetectHiddenWindows,Off
  Sleep,1000
  WinShow,ahk_id %info_1%
  StringReplace,closing,closing,%info_1%-%info_2%|
  Gosub,TRAYMENU
 }
Return



SETTINGS:
ok=0
Gui,Destroy
Gui,Margin,20,10

Gui,Add,GroupBox,xm-10 w300 h50,&Time to wait
Gui,Add,Edit,xm yp+20 w100 vtimeout
Gui,Add,UpDown,x+5,%timeout%
Gui,Add,Text,x+5 yp+2,seconds

Gui,Add,GroupBox,xm-10 y+20 w300 h50,Actions
Gui,Add,CheckBox,xm yp+20 vkill Checked%kill%,&Kill windows   Won't ask to save changed documents!

Gui,Add,GroupBox,xm-10 y+20 w300 h120,&Programs to ignore
Gui,Add,Edit,xm yp+20 r5 w280 vignore,%ignore%
Gui,Add,Text,xm y+5,Example: Notepad.exe,Calc.exe,Pbrush.exe

Gui,Add,GroupBox,xm-10 y+20 w300 h120,Cl&asses to ignore
Gui,Add,Edit,xm yp+20 r5 w280 vsystem,%system%
Gui,Add,Text,xm y+5,Example: Shell_TrayWnd,Progman,#32768

Gui,Add,Button,xm y+20 w75 gSETTINGSOK,&OK
Gui,Add,Button,x+5 w75 gSETTINGSCANCEL,&Cancel

Gui,Show,,%applicationname% Settings

Loop
{
  If ok=1
    Break
  MouseGetPos,x,y,winid,ctrlid
  WinGet,program,ProcessName,ahk_id %winid%
  WinGetClass,class,ahk_id %winid%
  ToolTip,Program: %program%`nClass:      %class%
  Sleep,100
}
ToolTip,
Return


GuiClose:
SETTINGSOK:
ok=1
Gui,Submit
Gosub,INIWRITE
Return


SETTINGSCANCEL:
ok=1
Gui,Destroy
Return


TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,%applicationname%,RECOVERALL
Menu,Tray,Add
Menu,Tray,Add,&Recover All,RECOVERALL
Menu,Tray,Add
DetectHiddenWindows,On
StringSplit,part_,closing,|
Loop,% part_0-1
{
  StringSplit,info_,part_%A_Index%,-
  WinGetTitle,title,ahk_id %info_1%
  Menu,Tray,Add,&%A_Index% - %title%,RECOVER
}
DetectHiddenWindows,Off
Menu,Tray,Add
Menu,Tray,Add,&Settings...,SETTINGS
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Default,%applicationname%
Menu,Tray,Tip,%applicationname%
Return


ABOUT:
ok=1
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.4
Gui,99:Font
Gui,99:Add,Text,y+10,Recover closed applications
Gui,99:Add,Text,y+10,- To recover, rightclick the tray icon and choose an application
Gui,99:Add,Text,y+10,- Doubleclick the tray icon to recover all closed applications
Gui,99:Add,Text,y+10,- If not recovered, it is gone in %timeout% seconds

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,https://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 Static10,Static14,Static18
    DllCall("SetCursor","UInt",hCurs)
  Return
}
Return


EXIT:
Gosub,CLOSEALL
ExitApp


INIREAD:
IniRead,timeout,%applicationname%.ini,Settings,timeout
If timeout=ERROR
  timeout=60
IniRead,kill,%applicationname%.ini,Settings,kill
If kill=ERROR
  kill=0
IniRead,ignore,%applicationname%.ini,Settings,ignore
If ignore=ERROR
  ignore=Notepad.exe
IniRead,system,%applicationname%.ini,Settings,system
If system=ERROR
  system=Shell_TrayWnd,Progman,#32768,Basebar,DV2ControlHost
StringReplace,ignore,ignore,%A_Space%`,,`,,All
StringReplace,ignore,ignore,`,%A_Space%,`,,All
StringReplace,system,system,%A_Space%`,,`,,All
StringReplace,system,system,`,%A_Space%,`,,All
Return


INIWRITE:
StringReplace,ignore,ignore,%A_Space%`,,`,,All
StringReplace,ignore,ignore,`,%A_Space%,`,,All
StringReplace,system,system,%A_Space%`,,`,,All
StringReplace,system,system,`,%A_Space%,`,,All
IniWrite,%timeout%,%applicationname%.ini,Settings,timeout
IniWrite,%kill%,%applicationname%.ini,Settings,kill
IniWrite,%ignore%,%applicationname%.ini,Settings,ignore
IniWrite,%system%,%applicationname%.ini,Settings,system
Return


However, I've noticed, that sometimes closing a window actually closes it instantly, and GoneIn60s doesn't handle it. Could someone, please, fix this rare issue? It happens quite randomly to me, can't provide steps to reproduce the problem.

I also suggest to add Middle click on the (X) button to close the window instantly [i.e. to tell GoneIn60s not to handle it].

4
Skrommel's Software / Captain
« on: October 08, 2012, 12:13 PM »
Thanks for this awesome utility, I find it quite useful, but I think it lacks such an option as creating rules.
Please, if it's not so hard - do add the rule support for this utility to automatically change specific windows' titles (based on ahk class, title and app_process) [with regEx support, if possible :)].

5
Skrommel's Software / MoveInactiveWin
« on: October 08, 2012, 12:05 PM »
I just discovered this small utility for myself and it's totally awesome!
However, it has a small bug: it works with an active window just as fine as with inactive ones, and that's wrong.
Please, fix it.

Pages: [1]
Go to full version