First, I have modified the script so that the sending to the clipboard occurs when the fader fires and not every time you scroll, this makes it much easier to modify. It also makes it 100x saner, I almost can't believe I didn't notice it.
New script:
Code:
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance FORCE
Menu, Tray, add
Menu, Tray, add, ClipWheel Help, HelpLabel
Menu, Tray, add, ClipWheel Credits, CreditsLabel
AutoTrim, off
GoSub, HelpLabel
;prime the variables
ClipLine = 1
delimcount = 2
;set up the GUI
Gui, 1:Default
Gui, Margin, 0,0
Gui +LastFound
GUI_ID:=WinExist()
gui, font, s16, Arial
Gui, -Caption +AlwaysOnTop +Border
Gui, Add, Text, vGuiText, Invisible Text Here
;OPTIONAL - binds middle mouse button to 'paste' operation
Mbutton::
Send, ^v
Gosub, nextitem
Return
;shift wheel down
nextitem:
+WheelDown::
SetTimer, CloseWindow, Off
ScrollUp = 0
ScrollDown = 1
ClipLine++
If ClipLine > delimcount
{
Clipline = 1
}
GoSub Spin
Return
;shift wheel up
+WheelUp::
SetTimer, CloseWindow, Off
ScrollUp = 1
ScrollDown = 0
If ClipLine <> 0
{
ClipLine--
}
If ClipLine = 0
{
ClipLine := delimcount
ScrollUp = 0
}
GoSub Spin
Return
;Main Routine
Spin:
;read text from clipboard file into memory
FileRead, ClipFileText, clipwheel.txt
;stringsplit that file based on the deliminator æ
StringSplit, ClipLineArray, ClipFileText, æ
;count total deliminators in file to determine upper limit
delimcount=
Loop, Parse, ClipFileText
{
If A_loopField=`æ
delimcount++
}
;recheck for mean limits
If clipline > %delimcount%
{
ClipLine := 1
}
If clipline < 1
{
Clipline := 1
}
;create a junk GUI with the same features as the text
;this is a hack to allow resizing of the GuiText control itself so that it fits
;correctly in the window, since there is unfortunately no "GuiControl, Delete" command
Gui, 3:Default
Gui, Margin, 0,0
Gui, font, s16, Arial
Gui, -Caption +Border
Gui, Add, Text, vt2, % ClipLineArray%ClipLine%
;this next command is more complicated than it looks
GuiControlGet, t2, Pos
Gui, Destroy
;update the GuiText control size with the values from above
Gui, 1:Default
GuiControl, Move, GuiText, x%t2x% y%t2y% w%t2w% h%t2h%
GuiControl,, GuiText, % ClipLineArray%ClipLine%
;display the GUI
ReShow:
Gui, Show, autosize xcenter y0 AlwaysOnTop NoActivate, ClipWheel
;set the timer to close the window and copy the text if the user stopped scrolling
SetTimer, CloseWindow, -1450 ;length of time before the displayed clipboard text fades and the clipboard is set
Return
;bypass clipwheel entirely
!^+c::
Send , ^c
Return
;user is copying text via control+c
;this is intentional, it's probably possible to scan for clip changes, perhaps via "While Clipboard <> ",
;but this would clash with other scripts I use that use the clipboard
~^c::
ClipBoard =
Send , ^c
ClipWait
AppendLine := Clipboard
FileAppend, %Appendline%, clipwheel.txt
FileAppend , æ, clipwheel.txt
;recalculate highest delim
delimcount=
Loop, Parse, ClipFileText
{
If A_loopField=`æ
delimcount++
}
;Set Current to highest (most recently copied)
;so when you copy and wheel down once, you are on the text that you just copied
;if you wheel up once, you have the second-to-last text
;this should it much easier to replace normal copy/paste behavior with clipwheel
ClipLine := delimcount
Return
;call a DLL to fade out the window gracefully
;in "Int",250" 250 is the duration in ms
CloseWindow:
ClipBoard := % ClipLineArray%ClipLine%
DllCall("AnimateWindow","UInt",GUI_ID,"Int",250,"UInt","0x90000")S
Return
^+F1::
HelpLabel:
message =
(
Clipwheel Hotkeys:
Ctrl + C: Copy selection text to the wheel
Shift + Scroll Wheel: Scroll through wheel items
Middle Mouse Button: Paste, and load next wheel item
Alt + Scroll Down: Goes to bottom line
Ctrl + Shift + 1: Empty the wheel
Ctrl + Alt + Shift + C: Copy to the clipboard, but not to the wheel
Ctrl + Shift + F1: This menu
Ctrl + Shift + F12: Kills the clipwheel application `(or use tray icon`)
Clip file is in working directory as ClipWheel.txt
See tray for credits!
)
Msgbox, % message
Return
CreditsLabel:
message =
(
RandallF 2009
Written in AutoHotKey
Special thanks to the AutoHotKey forum gurus and enguneer for getting
it on the right track, without you all this would not be possible!
)
Msgbox, % message
Return
^+F12::
ExitApp
^+1::
Gui, Cancel
FileDelete, clipwheel.txt
ClipFileText := ""
ClipBoard := ""
ClipLineArray%ClipLine% := ""
GuiControl,, GuiText, CLEARED
Return
!WheelDown::
ClipLine := delimcount
GoSub Spin
Return
For the modifications, to do this you would need to:
Either disable or greatly increase the duration of the fade timer(if you want a timeout or max wait), I assume you don't want both autofade and the click,
by commenting out this line in the SPIN: routine:
Code:
SetTimer, CloseWindow, -1450
Then, add a gLabel routine to this text so when clicked it will fire the routine:
Code:
Gui, Add, Text, vGuiText gMyLabel, Invisible Text Here
Use the following for the Label (at the bottom of the file probably):
Code:
MyLabel:
GoSub, CloseWindow
Return
Or maybe just
Code:
Gui, Add, Text, vGuiText gCloseWindow, Invisible Text Here
Really it's pretty easy to modify this script to fit the behavior that you desire, you could set up whatever bind or thing you want that just points at the close CloseWindow label and it will 'pick' the current line, even if it is not visible. Like I identified above for many behaviors you would want to disable the fader entirely.
Next version I'll try to add labels to the top so that you can easily change durations and other things...