;CopyCap-1.ahk (03/08/2008) ;a tool to copy active window's titlebar text and window class into clipboard. ;middle-click on the titlebar of any window to activate a menu that allows one ;to copy caption text and/or change it temporarily. ; #Persistent #SingleInstance force #NoEnv #NoTrayIcon SetBatchLines, -1 CoordMode, Mouse, Screen SetMouseDelay, -1 Menu, CopyCaption, Add, Copy Caption Text, CopyCaption Menu, CopyCaption, Add, Copy Caption and Windows Class Text, CopyCaption Menu, CopyCaption, Add, Change Caption, ChangeCaption Menu, CopyCaption, Add Menu, CopyCaption, Add, Post a feedback for this program, SendFeedback Menu, CopyCaption, Add, Exit, ExitSub OnExit, ExitSub Return CopyCaption: WinGetTitle, getTitle, ahk_id %WindowUnderMouseID% WinGetClass, getClass, ahk_id %WindowUnderMouseID% If A_ThisMenuItem=Copy Caption Text { ToolTip, Copied into clipboard:`n`nWindow title: %getTitle%. SetTimer, RemoveToolTip, 5000 Clipboard=%getTitle% ;Caption Only } Else { ToolTip, Copied into clipboard:`n`nWindow title: %getTitle% `nWindow class: ahk_class %getClass%. SetTimer, RemoveToolTip, 5000 Clipboard=%getTitle% ahk_class %getClass% ;Caption & Windows Class } Return ChangeCaption: WinGetTitle, getTitle, ahk_id %WindowUnderMouseID% Gui 10: Destroy Gui 10: +AlwaysOnTop +ToolWindow Gui 10: Add, Edit, vInput, %getTitle% Gui 10: Add, Button, Default ys, OK cutoff:=(A_ScreenWidth/3)*2 ;2/3rd of the screen If ClickX > %cutoff% ;if clicked part greater than 2/3rd of the screen then display in the center Gui 10: Show, xCenter y%ClickY%, Enter new title: Else Gui 10: Show, x%ClickX% y%ClickY%, Enter new title: Return 10GuiEscape: Gui 10: Destroy Return 10ButtonOK: ;for ChangeCaption Gui 10: Submit NewTitle = %Input% WinSetTitle, %getTitle%,,%NewTitle% ToolTip, Changed caption into:`n%NewTitle%. SetTimer, RemoveToolTip, 5000 Return MButton:: MouseGetPos, ClickX, ClickY, WindowUnderMouseID SendMessage, 0x84,, ( ClickY << 16 )|ClickX,, ahk_id %WindowUnderMouseID% If ErrorLevel in 2,3 ;in titlebar enclosed area - top of window { Menu, CopyCaption, Show Return } Else { If GetKeyState("MButton", "P") MouseClick, Middle, %ClickX%, %ClickY%,, Down Else MouseClick, Middle, %ClickX%, %ClickY% } Return SendFeedback: Run,http://www.donationcoder.com/Forums/bb/index.php?topic=14275.0,,UseErrorLevel Return RemoveToolTip: SetTimer, RemoveToolTip, Off ToolTip Return ExitSub: ExitApp