ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Selected Text Count

(1/1)

Nzyme:
Hi,

I am looking for a program which would instantly show the count of the selected items (list). I know that this can be done in Excel but I need this on a global basis (everywhere - desktop, inside a program, Notepad, Word, etc). In short any text that can be selected.

For example: When I select 3 icons on the desktop, it should show the count as 3 besides the mouse pointer (like tool help tip). Similarly, when I select text like:

Hello
This
is what
i need

it should show a count as 4 (4 lines selected). Additional information like number of characters, words, lines etc would be an icing to the cake.

Is such a program possible on a global basis in Windows?

Thanks!

MilesAhead:
You can experiment with this AHK script. I'm using AutoHotKey_L as sometimes that makes a difference.

For it to show the ToolTip you need to have the left mouse button down, then press and release the Left Control key. If you prefer right control key change LControl to RControl.

Should work for situations where you can select with the mouse, then keep the
mouse button down. The ToolTip clears the next time you click the mouse.

The reason for that is if it's active regardless of the mouse button state, it will be churning stuff to the clipboard to get the count.  Also it would likely interfere with using the clipboard normally. As it is, in the script I save clipboard text and restore it.  Saving everything, such as large graphics, would likely slow it down quite a bit.

If you get it to work to your liking you can compile with AHK_L and even add a custom icon to show in the tray. To get it to display the icon compiled into the exe, use these lines near the top:

--- ---if (A_IsCompiled)
  Menu Tray,Icon,%A_ScriptFullPath%,1

Selected Count Script


--- ---#SingleInstance force
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

count := 0
Selected := ""
SaveClipboard := ""
Return

~LButton::
  ToolTip
Return

~LControl::
  if not GetKeyState("LButton")
    Return
  SaveClipboard := Clipboard
  Clipboard =
  Send ^c
  ClipWait,1
  Selected = %Clipboard%
  if not Selected
    Return
  gosub,doToolTip
  Clipboard := SaveClipboard
Return

doToolTip:
  Loop, parse, clipboard, `n, `r
  {
    count := A_Index
  }
  ToolTip,%count%
Return

MilesAhead:
This version should be a bit smoother.  Instead of having to hold the mouse key down, select text or folders in Explorer, whatever.  Then hold down both Control keys, and release, to get the count. The ToolTip will display near the mouse cursor. The ToolTip will disappear on next mouse click.


--- ---#SingleInstance force
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
if (A_IsCompiled)
  Menu Tray,Icon,%A_ScriptFullPath%,1

count := 0
Selected := ""
SaveClipboard := ""
Return

~LButton::
  ToolTip
Return

~LControl & ~RControl::
  SaveClipboard := Clipboard
  Clipboard =
  Send ^c
  ClipWait,1
  Selected = %Clipboard%
  if not Selected
    Return
  gosub,doToolTip
  Clipboard := SaveClipboard
Return

doToolTip:
  Loop, parse, clipboard, `n, `r
  {
    count := A_Index
  }
  ToolTip,%count%
Return

anandcoral:
Nzyme you can give Paste Text Like a try. A pledge for NANY 2012.

https://www.donationcoder.com/forum/index.php?topic=27967.0

It gives the selected text line and character count along with some text manipulation options.

I will appreciate feedback to make it better.

Regards,

Anand

Navigation

[0] Message Index

Go to full version