Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

"Tagging" Windows



  • Please log in to reply
4 replies to this topic
Outline
  • Members
  • 14 posts
  • Last active: Oct 20 2015 08:25 AM
  • Joined: 18 Sep 2015

In a script I'm writing I need to have the script remember what windows were used,to have thing track tagged windows, E.g I tag a window with a hot key, it creates a tool tip that follows the window that says "This window has been tagged" for all tagged windows, Closing the tool tip when they disappear and recreating it when they reappear.

Thanks in advance

-Outline



boiler
  • Members
  • 252 posts
  • Last active: Nov 07 2015 09:39 PM
  • Joined: 04 Jun 2014
✓  Best Answer

Try this.  Ctrl-F1 to tag a window, Ctrl-Esc to exit the script.  It will not show the tooltip if the window is minimized, but it will still show the tooltip even if the window is covered by another window.

#SingleInstance, Force
CoordMode, ToolTip, Screen
WinTags := []
LastX := []
LastY := []
CountChanged := 0
SetTimer, UpdateTags, 50
return

^F1::
	WinGet, NewHwnd, ID, A
	LastX.Insert(0) ; these are to prevent flashing tooltips
	LastY.Insert(0)
	WinTags.Insert(NewHwnd)
return

UpdateTags:
	Loop, % WinTags.MaxIndex()
	{
		ThisHwnd := WinTags[A_Index]
		WinGetPos, WinX, WinY,,, ahk_id%ThisHwnd%
		if (WinExist("ahk_id" . ThisHwnd)) && (!((WinX = LastX[A_Index]) && (WinY = LastY[A_Index])) || CountChanged)
		{
			WinGet, Status, MinMax, ahk_id%ThisHwnd%
			if (Status = -1)
				ToolTip,,,, A_Index
			else
				ToolTip, This window has been tagged, WinX, WinY, A_Index
			LastX[A_Index] := WinX
			LastY[A_Index] := WinY
			CountChanged := 0
		}
		IfWinNotExist, ahk_id%ThisHWnd%
		{
			LastX.Remove(A_Index)
			LastY.Remove(A_Index)
			WinTags.Remove(A_Index)
			ToolTip,,,, A_Index
			CountChanged := 1
		}
	}
return

^Esc::ExitApp



Outline
  • Members
  • 14 posts
  • Last active: Oct 20 2015 08:25 AM
  • Joined: 18 Sep 2015

This works, But it isn't quite what i want, I was thinking more of a toggle-able design, and one that has a capacity of more then 20 windows.



boiler
  • Members
  • 252 posts
  • Last active: Nov 07 2015 09:39 PM
  • Joined: 04 Jun 2014

You didn't say toggle-able.  And what limits it to 20?

 

Now that you have this, you can add whatever features you want.

 

You're welcome.



Outline
  • Members
  • 14 posts
  • Last active: Oct 20 2015 08:25 AM
  • Joined: 18 Sep 2015

Nevermind

:)