Jump to content

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

InfoToolTip


  • Please log in to reply
21 replies to this topic

Poll: Do you like InfoToolTip? (11 member(s) have cast votes)

Do you like InfoToolTip?

  1. Yes (9 votes [81.82%])

    Percentage of vote: 81.82%

  2. No (2 votes [18.18%])

    Percentage of vote: 18.18%

Vote Guests cannot vote
HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Based on TT library I've created another one nice alternative to AU3_Spy.exe.
Enjoy ;)

 

Following settings cannot be changed in ToolTip - Settings, please define those in script at the top.
- Hotkey
- BGColor
- TextColor
- UpdateTextTimer
- UpdatedPosTimer

InfoToolTip.png

;Please note for Link feature XP++ is requiered
/*
[Config]
Hotkey=#q
UseBalloon=0
BGColor=FFFFFF
TextColor=Black

HideOnClick=0
ExitOnClick=0

UpdatePosTimer=40
UpdateTextTimer=400


[Items]
Window=1
Control=1
Mouse=1
Color=1
Time=1

[Script]
*/
;____SCRIPT_____________________________ 
#NoEnv
#SingleInstance Force
CoordMode, Mouse, Relative
Menu, Tray, NoStandard
Menu, Tray, Add,&Show InfoToolTip,Restart
Menu, Tray, Add,E&xit,Exit
OnMessage(0x404,"AHK_NotifyTrayIcon") ;Will pop up the ToolTip when you click on Tray Icon


Gosub, ReadIni
Hotkey, %Hotkey%,Restart
VarSetCapacity(xc, 20, 0), xc := Chr(20)

MainText=<a>Config</a>`t<a http://www.autohotkey.com/board/topic/41023-infotooltip/>Visit forum</a>`t<a>Hide</a>`t<a>Exit</a>
Sleep, 10 ;requiered, otherwise first tooltip will appear at wrong position

TT:=TT("P=1 ParseLinks CloseButton MaxWidth=300 OnClick=OnTTClick OnClose=OnTTClose" (UseBalloon?" Balloon":"") (BGColor!=""?" BackGround=" BGColor:"") (TextColor!=""?" Color=" TextColor:""))
TS:=TT("P=1 ParseLinks CloseButton MaxWidth=300 OnClick=OnTSClick OnClose=OnTSClose" (UseBalloon?" Balloon":"") (BGColor!=""?" BackGround=" BGColor:"") (TextColor!=""?" Color=" TextColor:""),"","InfoToolTip Config")
Restart:
Gosub, UpdateText
SetTimer, UpdateText,% UpdateTextTimer ? UpdateTextTimer : 500
SetTimer, UpdatePos, % UpdatePosTimer ? UpdatePosTimer : 50
Return

UpdateText:
wininfo:=""
MouseGetPos,,, WinId
If (TT.hWnd=WinId)
  Return
hIcon:=CreateIcon(RGBColor)
If Window {
  WinGetClass, class,ahk_id %WinId%
  WinGetTitle, title,ahk_id %WinId%
WinGetPos,WX,WY,WW,WH,ahk_id %WinId%
  wininfo.="Win:`t<a copy " title ">" title "</a>`n`t<a copy ahk_class " class ">ahk_class " class "</a>  <a copy ahk_id " WinId ">ahk_id " WinId "</a>`n"
          . "`tX, Y: <a copy " WX ", " WY "> " WX ", " WY "</a>  W, H:<a copy " WW ", " WH "> " WW ", " WH "</a>`n"
}
If Control {
  MouseGetPos,,,, ControlClass
  DllCall("GetCursorInfo", "Uint", &xc)
  yc := NumGet(xc,16), xc := NumGet(xc,12)
  ControlGet,ControlId,Hwnd,,%ControlClass%,ahk_id %WinId%
  ControlGetPos,CX,CY,CW,CH,%ControlClass%,ahk_id %WinId%
  wininfo.="Control:`t<a copy " controlClass ">" controlClass "</a>  <a copy " ControlId ">" ControlId "</a>`n`tPos: <a copy " CX ", " CY ">" CX ", " CY "</a>  Size: <a copy " CW ", " CH ">" CW ", " CH "</a>`n"
}
If Mouse {
  MouseGetPos, X, Y
  wininfo.="Mouse:`tScreen: <a copy " xc ", " yc ">" xc ", " yc "</a>  Win: <a copy " x ", " y ">" x ", " y "</a>`n"
}
If Color {
  wininfo.="Color:`tRGB: <a copy " RGBColor ">" RGBColor "</a>  BGR: <a copy " BGRColor ">" BGRColor "</a>`n"
  PixelGetColor,BGRColor,%x%,%y%
  PixelGetColor,RGBColor,%x%,%y%,RGB
}
If Time
  wininfo.="Time:`t<a copy " A_Hour ":" A_Min ":" A_Sec ">" A_Hour ":" A_Min ":" A_Sec "</a>`n"
wininfo.="`n"
If !(GetKeyState("CTRL","P") or GetKeyState("Alt","P") or GetKeyState("Shift","P"))
  TT.Show(wininfo . MainText,"","","InfoToolTip (Ctrl/Alt/Shift + Click to copy)",Color?hIcon:"")
Return

UpdatePos:
  If !(GetKeyState("CTRL","P") or GetKeyState("Alt","P") or GetKeyState("Shift","P"))
    TT.Show()
Return

Config:
  SetTimer, UpdatePos,Off
  SetTimer, UpdateText,Off
  TT.Close(),TS.Show(Settings,"","","InfoToolTip Settings")
Return

OnTSClick(TT,option){
  global
  opt:=SubStr(option,1,InStr(option,"_",1,0)-1)
  %opt%:=SubStr(option,InStr(option,"_",1,0)+1)
  SetTimer, UpdateSettings, -100
}
OnTSClose(TT){
  SetTimer,Restart,-100
}
OnTTClose(TT){
  SetTimer, UpdatePos,Off
  SetTimer, UpdateText,Off
}

UpdateSettings:
Loop,Parse,Options,|
  IniWrite,% %A_LoopField%,%A_ScriptFullPath%,Config,%A_LoopField%
Loop,Parse,AllItems,|
  IniWrite,% %A_LoopField%,%A_ScriptFullPath%,Items,%A_LoopField%
Gosub, ReadIni
Return


OnTTClick(TT,option){
  global
  If InStr(option,"copy "){
    Clipboard:= SubStr(option,6)
  } else if InStr(link:=option,"http://")
    Run iexplore.exe %link%
  else if (option="Config"){
    gosub,Config
    Return
  } else if IsLabel(label:=RegExReplace(link,"[^\w\.]","_"))
    SetTimer % label,-100
  If ExitOnClick
    ExitApp
  else if (option="hide" || HideOnClick){
    TT.Hide()
    SetTimer,UpdateText,Off
    SetTimer,UpdatePos,Off
  }
}

Exit:
  ExitApp
Return

ReadIni:
Settings=
inivars=Hotkey|UseBalloon|BGColor|TextColor|HideOnClick|ExitOnClick|UpdatePosTimer|UpdateTextTimer|Items
Loop,Parse,inivars,|
  IniRead,%A_LoopField%,%A_ScriptFullPath%,Config,%A_LoopField%,%A_Space%
  
AllItems=Window|Control|Mouse|Color|Time
Loop,Parse,AllItems,|
  IniRead,%A_LoopField%,%A_ScriptFullPath%,Items,%A_LoopField%,%A_Space%
Settings:="Information Items:`n"
Loop,Parse,AllItems,|
  Settings.= "`t" . (%A_LoopField% ? ("(On) - <a " . A_LoopField . "_0>Off</a>") : ("<a " . A_LoopField . "_1>On</a> - (Off)")) . "`t" . A_LoopField . "`n"
Options=UseBalloon|HideOnClick|ExitOnClick
Settings.="`nUser Settings:`n"
Loop,Parse,Options,|
  Settings.= "`t" . (%A_LoopField% ? ("-  (On) - <a " . A_LoopField . "_0>Off</a>") : ("<a " . A_LoopField . "_1>On</a> - (Off)")) . "`t`t" . A_LoopField . "`n"
Return

AHK_NotifyTrayIcon(wParam, lParam) {
   If (lparam = 0x201 or lparam = 0x202)
      SetTimer, Restart, -100
}

CreateIcon(backclr){
  static
  width := 16, height := 16
  if !(hdcScreen := DllCall("GetDC","uint",0)) 
    return 
  VarSetCapacity(buf,40,0), NumPut(40,buf), NumPut(1,buf,12,"ushort") 
  NumPut(16,buf,4), NumPut(16,buf,8), NumPut(32,buf,14,"ushort") 

  ; Note that a compatible bitmap's format depends on the current display settings. 
  ; Changing the display depth after creating the icon may cause colour loss. 
  ;if hbm := DllCall("CreateCompatibleBitmap","uint",hdcScreen,"int",width,"int",height) 

  if hbm := DllCall("CreateDIBSection","uint",hdcScreen,"uint",&buf,"uint",0 
                ,"uint*",pBits,"uint",0,"uint",0) 
  { 
    if hdc := DllCall("CreateCompatibleDC","uint",hdcScreen) 
    { 
      ; Select the bitmap into a device context to draw on it. 
      ; Note that the previous bitmap should always be reselected afterwards. 
      if hbm_old := DllCall("SelectObject","uint",hdc,"uint",hbm) 
        DllCall("SelectObject","uint",hdc,"uint",hbm_old) 

      ; Since GDI doesn't support alpha-blending, we must manually set the 
      ; pixels to our background colour. We must also set the alpha component 
      ; of each bar pixel to 255, otherwise bars become mostly invisible. 
      offset = 0 
      Loop, %height% { 
        Loop, %width% { 
          px := NumGet(pBits+offset) 
          NumPut(px ? 255<<24|px : backclr, pBits+offset) 
          offset += 4 
        } 
      } 

      VarSetCapacity(mask,64,0) 
      hbm_mask := DllCall("CreateBitmap","int",width,"int",height,"uint",1,"uint",1,"uint",&mask) 

      DllCall("DeleteDC","uint",hdc) 
    } 
  } 
  DllCall("ReleaseDC","uint",0,"uint",hdcScreen) 

  hicon_old := hicon 

  VarSetCapacity(ii,20,0), NumPut(1,ii,0), NumPut(hbm,ii,16), NumPut(hbm_mask,ii,12) 
  Return hicon := DllCall("CreateIconIndirect","uint",&ii) 
}

Update:

12.05.2013 - Compacted information and updated to use TT Library



ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
Deeply impressed :D

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Deeply impressed :D


Thank you, I'm impressed about ToolTip functionality as well :D
I like ToolTips ;)

Drugwash
  • Members
  • 1078 posts
  • Last active: May 24 2016 04:20 PM
  • Joined: 07 Sep 2008
This tooltip will follow the mouse everywhere but most importantly it disables tray context menu so it can't be killed through standard method - need to invoke the "three finger salute" or third-party task managers.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

This tooltip will follow the mouse everywhere but most importantly it disables tray context menu so it can't be killed through standard method - need to invoke the "three finger salute" or third-party task managers.


Thanks for letting know, I have added the Tray functions now and noted that XP++ is required.

Additinally there are new options:

BGColor - Background Color of ToolTip
TextColor - Text Color
AutoColor - Adjust Background Color to color under ToolTip (does not work on Vista)



Drugwash
  • Members
  • 1078 posts
  • Last active: May 24 2016 04:20 PM
  • Joined: 07 Sep 2008
Well, XP++ is not necessarily required for viewing the info - only for having links accessible. It still works in 9x and displays the data correctly but links (as mentioned in the main tooltip topic) can't work.

AutoColor is kinda funny; was about to file it as a bug if I didn't read the changelog more carefully. :D

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Fixed to get the right color under mouse. (wrong x y coordinates were used)

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
It would be nice, not to change the color of the whole TT but to insert a small Control, that shows the color. Otherwise the content of the TT isn't readable, when the pixel under the cursor is dark.

DreymaR
  • Members
  • 89 posts
  • Last active: Jun 19 2013 08:03 AM
  • Joined: 24 May 2009
I was going to ask for a change of text color when the background becomes dark, but ruespe's suggestion is better. Make it a bar at the top of the window or something - much less noisy on the eye as well.
Better burden you cannot carry than man-wisdom much -- Hávamál

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
I have not yet found a solution but have a few ideas.
I'll have a look in the evening and hope to get a solution :)

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

- Instead changing Background, ToolTips icon will get the colour under mouse


I haven't thought I find a solution that fast.
Many thanks for Lexikos contribution in following post MakeICOBars - Create icon bar graphs for tray & pic

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
:p :idea: :!: :p

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
I've added Settings, easily click on Settings in main ToolTip.

There you can select which information to show in main ToolTip and you can change some user settings there.

If you would like to see any other information within this ToolTip, please ask and I might add it.

robertcollier4
  • Members
  • 141 posts
  • Last active: Jun 28 2019 01:05 AM
  • Joined: 11 Nov 2012
Very nice. I like a lot and will be using as my replacement for Window Spy. However - a lot of space is wasted in the window making the tooltip unncessarily large. It would be nice if it could be made as condensed as possible so it isn't intrusive on the screen. See following screenshot of some quick modifications to the script which conserve space.

1. The time is not needed on the titlebar. Just "InfoToolTip" would suffice instead of "Welcome by InfoToolTip <time>". Since the time is already shown below also anyways.
2. Instead of having ExitApp and a separate X button on the top - you could just have "Exit" and "Hide" as a "-" (Minimize) and "X" (Exit) icons where the current X icon is - and not need to have "Hide ToolTip" and "Exit App" below. This will also enable you to get rid of the "Do you want to exit InfoToolTip" secondary dialog which is annoying if I click on the X to have to double-confirm that I want to exit.
3. Lower the amount of tab indentations used after the colon so things don't have to wordwrap.
4. Unnecessary line breaks could also be removed such as below the last line. Also don't need " - " before all the lines. Or use "- " instead if you demarcating new lines in case some things might need to wordwrap.
 
Download: InfoToolTip-condensed.ahk

Example before and after:
origa.gif9rq.gif

h3boy
  • Members
  • 1 posts
  • Last active: May 16 2013 03:17 AM
  • Joined: 12 May 2013

Very nice. I like a lot and will be using as my replacement for Window Spy. However - a lot of space is wasted in the window making the tooltip unncessarily large. It would be nice if it could be made as condensed as possible so it isn't intrusive on the screen. See following screenshot of some quick modifications to the script which conserve space.

1. The time is not needed on the titlebar. Just "InfoToolTip" would suffice instead of "Welcome by InfoToolTip <time>". Since the time is already shown below also anyways.
2. Instead of having ExitApp and a separate X button on the top - you could just have "Exit" and "Hide" as a "-" (Minimize) and "X" (Exit) icons where the current X icon is - and not need to have "Hide ToolTip" and "Exit App" below. This will also enable you to get rid of the "Do you want to exit InfoToolTip" secondary dialog which is annoying if I click on the X to have to double-confirm that I want to exit.
3. Lower the amount of tab indentations used after the colon so things don't have to wordwrap.
4. Unnecessary line breaks could also be removed such as below the last line. Also don't need " - " before all the lines. Or use "- " instead if you demarcating new lines in case some things might need to wordwrap.
 
Download: InfoToolTip-condensed.ahk

Example before and after:
origa.gifinfotooltipcondensed.gif

Good for you. However,I use the unicode version of AHK_L with which this script cannot work. It works well if I change the version of AHK_L to ansi, but it cannot work after I compiled it to exe file.So could you please upload a executed version of this script?shy.png