DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Req - Clickable Tooltips for Pasting  (Read 4,393 times)

Smobu

  • Participant
  • Joined in 2008
  • *
  • Posts: 51
Req - Clickable Tooltips for Pasting
« on: July 31, 2009, 12:28 AM »
Clickable Tooltips for Pasting

I was hoping tha someone could modify this script to make it so that the tooltips are allowed to paste when they are clicked upon.
The windows key and v key are used to cycle through the entries that were copied earlier. I use this to mainly copy text and rename files easier.
The reason that I use this script as opposed to others is that this script does not steal the focus for renaming files.

Code: (autoit)
clip_index = 0
clip_max = 5
clip_1 = Text
clip_active = 1

CoordMode, tooltip, screen

goto clip_end_label

OnClipboardChange:
if clip_active
	addClip(clipboard)
clip_active = 1
return

addClip(text)
{
	global
	if text =
		return
	local old
	old := clip_%clip_index%
	if  old = %text%
		return
	clip_index := mod(clip_index+1,clip_max)
	clip_%clip_index% = %text%
}

#V::
clip_tmp=1
v_was=1
loop
{
	Loop %clip_max%
	{
		index := mod(clip_max+clip_index-A_Index+1,clip_max)
		element := clip_%index%
		element := ShortenClip(element)
		i1 := A_Index+1
		if element
			ToolTip, %element%, 30+60*(A_Index=clip_tmp), 60*A_Index-50,i1
	}
	res := GetKeyState("LWin","P")+GetKeyState("RWin","P")
	esc__ := GetKeyState("Escape","P")
	if (res=0)
		break
	if (esc__=1)
		break
	res := GetKeyState("V","P")
	if res=1
		if v_was=0
		loop
		{
			clip_tmp := 1+mod(clip_tmp,clip_max)
			index := mod(clip_max+clip_index-clip_tmp+1,clip_max)
			element := clip_%index%
			if element
				break
		}
	v_was := res
	Sleep, 50
	}
Loop %clip_max%
{
	i1 := A_Index+1
	ToolTip, , , , i1
}
if (esc__=1)
	return
index := mod(clip_max+clip_index-clip_tmp+1,clip_max)
clip_active =
clipboard := clip_%index%
Send, ^v
return

ShortenClip(text)
{
	Loop, Parse, text, `n
	{
		StringLeft, outline, A_LoopField, 40
		out = %out%%outline%`n
		if A_Index>2
		{
			out = %out%.....
			break
		}
	}
	return out
}


clip_end_label:
« Last Edit: July 31, 2009, 12:31 AM by Smobu »

Original address: https://www.donationcoder.com/forum/index.php?topic=19361.0