Skip to content

Commit c9fd447

Browse files
committed
v1.108 timestamp related updates
1 parent 6836c9d commit c9fd447

File tree

5 files changed

+89
-20
lines changed

5 files changed

+89
-20
lines changed

changelog.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Changelog
22

3+
### v1.108
4+
5+
* New: also show timestamp in tooltip (cycle forward, backward, plugin) and search.
6+
* New: also show number of lines in search results (number only)
7+
* Change: timestamp now has two parts, separated by a pipe character (|)
8+
first part (before |): either a character, default @, or a number, for example 128336 for Unicode clock character 🕐
9+
second part (after |): time format options - see v1.107
10+
* Change: when cycling back past "z" show number in tooltip instead of character that no longer had any relation to "menu order"
11+
312
### v1.107
413

514
* New: Option to show timestamp in clipboard history menu - https://github.com/hi5/CL3/issues/23
615
See https://www.autohotkey.com/docs/v1/lib/FormatTime.htm#Time_Formats for options (e.g. HH:mm (24hr) or hh:mm tt (12hr AM/PM))
7-
* Fix: Open Template folder - now use commander_path env. variable/registry combined with WinGet ProcessPath/ProcessName, so it should now work with running 32/64 versions. Starts 32bit by default if TC is not running but can be detected.
16+
* Fix: Open Template folder - now use commander_path environment variable/registry combined with WinGet ProcessPath/ProcessName, so it should now work with running 32/64 versions. Starts 32bit by default if TC is not running but can be detected.
817
* Fix: Use MenuWidth setting in DispMenuText() function to check length instead of previously hardcoded value of 60
918

1019
### v1.106

cl3.ahk

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/*
22
3-
Script : CL3 ( = CLCL CLone ) - AutoHotkey 1.1+ (Ansi and Unicode)
4-
Version : 1.107
3+
Script : CL3 ( = CLCL CLone ) - AutoHotkey 1.1+
4+
Version : 1.108
55
Author : hi5
6-
Purpose : A lightweight clone of the CLCL clipboard caching utility which can be found at
7-
http://www.nakka.com/soft/clcl/index_eng.html written in AutoHotkey
6+
Purpose : CL3 started as a lightweight clone of the CLCL clipboard caching utility
7+
which can be found at http://www.nakka.com/soft/clcl/index_eng.html.
8+
But some unique features have been added making it more versatile
9+
"text only" Clipboard manager.
810
Source : https://github.com/hi5/CL3
911
1012
Features:
@@ -40,7 +42,7 @@ SetWorkingDir, %A_ScriptDir%
4042
AutoTrim, off
4143
StringCaseSense, On
4244
name:="CL3 "
43-
version:="v1.107"
45+
version:="v1.108"
4446
CycleFormat:=0
4547
Templates:={}
4648
Global CyclePlugins,History,SettingsObj,Slots,ClipChainData ; CyclePlugins v1.72+, others v1.9.4 for API access
@@ -58,7 +60,7 @@ loop, parse, iconlist, CSV
5860
icon%A_LoopField%:="icon-" A_LoopField ".ico"
5961

6062
; <for compiled scripts>
61-
;@Ahk2Exe-SetFileVersion 1.107
63+
;@Ahk2Exe-SetFileVersion 1.108
6264
;@Ahk2Exe-SetDescription CL3
6365
;@Ahk2Exe-SetCopyright MIT License - (c) https://github.com/hi5
6466
; </for compiled scripts>
@@ -303,7 +305,13 @@ While GetKeyState(hk_cyclemodkey,"D") and cyclebackward
303305
If (ClipCycleCounter = 1) and (ClipboardPrivate = 1)
304306
Indicator:="*"
305307
If (ClipCycleCounter <> 0)
306-
ttext:=% Chr(96+ClipCycleCounter) Indicator " : " DispToolTipText(History[ClipCycleCounter].text)
308+
{
309+
If (ClipCycleCounter < 27)
310+
ClipCycleCounterIndicator:=Chr(96+ClipCycleCounter)
311+
Else
312+
ClipCycleCounterIndicator:=ClipCycleCounter
313+
ttext:=% ClipCycleCounterIndicator Indicator " : " DispToolTipText(History[ClipCycleCounter].text,,History[ClipCycleCounter].time)
314+
}
307315
else
308316
ttext:="[cancelled]"
309317
If (oldttext <> ttext)
@@ -352,8 +360,12 @@ While GetKeyState(hk_cyclemodkey,"D") and cycleforward
352360
Indicator:=""
353361
If (ClipCycleCounter = 1) and (ClipboardPrivate = 1)
354362
Indicator:="*"
363+
If (ClipCycleCounter < 27)
364+
ClipCycleCounterIndicator:=Chr(96+ClipCycleCounter)
365+
Else
366+
ClipCycleCounterIndicator:=ClipCycleCounter
355367
If (ClipCycleCounter <> 0)
356-
ttext:=% Chr(96+ClipCycleCounter) Indicator " : " DispToolTipText(History[ClipCycleCounter].text)
368+
ttext:=% ClipCycleCounterIndicator Indicator " : " DispToolTipText(History[ClipCycleCounter].text,,History[ClipCycleCounter].time)
357369
else
358370
ttext:="[cancelled]"
359371
If (oldttext <> ttext)
@@ -397,16 +409,25 @@ If (ClipCycleCounter = 0) or (ClipCycleCounter = "")
397409
ClipCycleCounter:=1
398410
While GetKeyState(hk_cyclemodkey,"D")
399411
{
412+
If ShowTime
413+
{
414+
time:=History[ClipCycleCounter].time
415+
If TimeFormat and time
416+
{
417+
FormatTime, disptime, %time%, %TimeFormatTime%
418+
disptime := Ltrim(TimeFormatIndicator) disptime " "
419+
}
420+
}
400421
If (ClipCycleCounter <> 0)
401-
ttext:=% "Plugin: " ((CyclePlugins.HasKey(CycleFormat) = "0") ? "[none]" : CyclePlugins[CycleFormat]) CyclePluginsToolTipLine DispToolTipText(History[ClipCycleCounter].text,CycleFormat)
422+
ttext:=% disptime "Plugin: " ((CyclePlugins.HasKey(CycleFormat) = "0") ? "[none]" : CyclePlugins[CycleFormat]) CyclePluginsToolTipLine DispToolTipText(History[ClipCycleCounter].text,CycleFormat)
402423
else
403424
ttext:="Plugin: [cancelled]" CyclePluginsToolTipLine
404425
If (oldttext <> ttext)
405426
{
406427
ToolTip, % ttext, %A_CaretX%, %A_CaretY%
407428
oldttext:=ttext
408429
}
409-
430+
disptime:="",time:=""
410431
Sleep 100
411432
KeyWait, %hk_cycleplugins% ; This prevents the keyboard's auto-repeat feature from interfering.
412433
}
@@ -648,7 +669,7 @@ Return
648669

649670
DispMenuText(TextIn,lines="1",time="")
650671
{
651-
global MenuWidth,ShowLines,LineTextFormat,ShowTime,TimeFormat
672+
global MenuWidth,ShowLines,LineTextFormat,ShowTime,TimeFormat,TimeFormatIndicator,TimeFormatTime
652673

653674
If (lines=1)
654675
linetext:=LineTextFormat[1]
@@ -676,22 +697,31 @@ DispMenuText(TextIn,lines="1",time="")
676697
disptime:=""
677698
If TimeFormat and Time
678699
{
679-
FormatTime, disptime, %time%, %TimeFormat%
680-
TextOut .= " " Chr(128336) " " disptime
700+
FormatTime, disptime, %time%, %TimeFormatTime%
701+
TextOut .= TimeFormatIndicator disptime
681702
}
682703
}
683704

684705
Return LTRIM(TextOut," `t")
685706
}
686707

687-
DispToolTipText(TextIn,Format=0)
708+
DispToolTipText(TextIn,Format=0,time=0)
688709
{
710+
Global ShowTime, TimeFormat, TimeFormatIndicator, TimeFormatTime
689711
TextOut:=RegExReplace(TextIn,"^\s*")
690712
TextOut:=SubStr(TextOut,1,750)
691713
;StringReplace,TextOut,TextOut,`;,``;,All
692714
FormatFunc:=StrReplace(CyclePlugins[Format]," ")
693715
If IsFunc(FormatFunc)
694716
TextOut:=%FormatFunc%(TextOut)
717+
If ShowTime
718+
{
719+
If TimeFormat and Time
720+
{
721+
FormatTime, disptime, %time%, %TimeFormatTime%
722+
TextOut := Ltrim(TimeFormatIndicator) disptime "`n" TextOut
723+
}
724+
}
695725
Return TextOut
696726
}
697727

lib/settings.ahk

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Settings()
3434
IniRead, BackupTimer , %ini%, settings, BackupTimer, 10
3535
IniRead, Exclude , %ini%, settings, Exclude, 0
3636
IniRead, LineFormat , %ini%, settings, LineFormat, \t(\l line),\t(\l lines)
37-
IniRead, TimeFormat , %ini%, settings, TimeFormat, HH:mm
37+
IniRead, TimeFormat , %ini%, settings, TimeFormat, @|HH:mm
3838
IniRead, SettingsFolders , %ini%, settings, SettingsFolders, 0
3939
IniRead, ShowSpecial , %ini%, settings, ShowSpecial , 1
4040
IniRead, ShowTemplates , %ini%, settings, ShowTemplates, 1
@@ -58,6 +58,20 @@ Settings()
5858
folders:=StrReplace(folders,"%A_" Trim(A_LoopField," ") "%", %tmpfolder%)
5959
}
6060

61+
If InStr(TimeFormat,"|")
62+
{
63+
TimeFormatIndicator:=StrSplit(TimeFormat,"|").1
64+
If TimeFormatIndicator is number
65+
TimeFormatIndicator:=Chr(TimeFormatIndicator)
66+
TimeFormatIndicator:=A_Space TimeFormatIndicator A_Space
67+
TimeFormatTime:=StrSplit(TimeFormat,"|").2
68+
}
69+
Else
70+
{
71+
TimeFormatIndicator:=""
72+
TimeFormatTime:=TimeFormat
73+
}
74+
6175
ClipDataFolder:=StrSplit(folders,";").1 "\ClipData\"
6276
If (ClipDataFolder = "\ClipData\")
6377
ClipDataFolder:=A_ScriptDir "\ClipData\"
@@ -137,7 +151,7 @@ Settings_Default()
137151
, ShowMorehistory : 1
138152
, ShowExit : 1
139153
, Exclude : ""
140-
, TimeFormat : "HH:mm"
154+
, TimeFormat : "@|HH:mm"
141155
, LineFormat : "\t(\l line),\t(\l lines)" }
142156
}
143157

plugins/search.ahk

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,22 @@ StartList:=""
3434
for k, v in History
3535
{
3636
add:=v.text
37+
time:=v.time
38+
if ShowLines
39+
linetext:=" - " v.lines
40+
else
41+
linetext:=""
42+
43+
disptime:=""
3744
stringreplace, add, add, |,,All
3845
stringreplace, add, add, `n,%A_Space%,All
39-
StartList .= "[" SubStr("00" A_Index,-2) "] " Add "|"
46+
If ShowTime
47+
If TimeFormat and Time
48+
{
49+
FormatTime, disptime, %time%, %TimeFormatTime%
50+
disptime := Ltrim(TimeFormatIndicator) disptime " "
51+
}
52+
StartList .= disptime "[" SubStr("00" A_Index,-2) linetext "] " Add "|"
4053
}
4154

4255
Gui, Search:Destroy
@@ -81,7 +94,10 @@ if (Choice = "")
8194
{
8295
ControlGet, Choice, list, , ListBox1, A
8396
}
84-
id:=Ltrim(SubStr(Choice,2,InStr(Choice,"]")-2),"0")
97+
; id:=Ltrim(SubStr(Choice,2,InStr(Choice,"]")-2),"0")
98+
RegExMatch(Choice,"\[0*(\d+)",id)
99+
Id:=id1
100+
id1:=""
85101
if (id = "")
86102
id:=1
87103
ClipText:=History[id].text

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CL3 <sup>v1.107</sup> - Clipboard caching utility
1+
# CL3 <sup>v1.108</sup> - Clipboard caching utility
22

33
CL3 started as a lightweight clone of the CLCL clipboard caching utility
44
which can be found at <http://www.nakka.com/soft/clcl/index_eng.html>.

0 commit comments

Comments
 (0)