Skip to content

Commit

Permalink
v1.108 timestamp related updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hi5 committed Jul 5, 2023
1 parent 6836c9d commit c9fd447
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 20 deletions.
11 changes: 10 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Changelog

### v1.108

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

### v1.107

* New: Option to show timestamp in clipboard history menu - https://github.com/hi5/CL3/issues/23
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))
* 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.
* 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.
* Fix: Use MenuWidth setting in DispMenuText() function to check length instead of previously hardcoded value of 60

### v1.106
Expand Down
58 changes: 44 additions & 14 deletions cl3.ahk
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/*
Script : CL3 ( = CLCL CLone ) - AutoHotkey 1.1+ (Ansi and Unicode)
Version : 1.107
Script : CL3 ( = CLCL CLone ) - AutoHotkey 1.1+
Version : 1.108
Author : hi5
Purpose : A lightweight clone of the CLCL clipboard caching utility which can be found at
http://www.nakka.com/soft/clcl/index_eng.html written in AutoHotkey
Purpose : CL3 started as a lightweight clone of the CLCL clipboard caching utility
which can be found at http://www.nakka.com/soft/clcl/index_eng.html.
But some unique features have been added making it more versatile
"text only" Clipboard manager.
Source : https://github.com/hi5/CL3
Features:
Expand Down Expand Up @@ -40,7 +42,7 @@ SetWorkingDir, %A_ScriptDir%
AutoTrim, off
StringCaseSense, On
name:="CL3 "
version:="v1.107"
version:="v1.108"
CycleFormat:=0
Templates:={}
Global CyclePlugins,History,SettingsObj,Slots,ClipChainData ; CyclePlugins v1.72+, others v1.9.4 for API access
Expand All @@ -58,7 +60,7 @@ loop, parse, iconlist, CSV
icon%A_LoopField%:="icon-" A_LoopField ".ico"

; <for compiled scripts>
;@Ahk2Exe-SetFileVersion 1.107
;@Ahk2Exe-SetFileVersion 1.108
;@Ahk2Exe-SetDescription CL3
;@Ahk2Exe-SetCopyright MIT License - (c) https://github.com/hi5
; </for compiled scripts>
Expand Down Expand Up @@ -303,7 +305,13 @@ While GetKeyState(hk_cyclemodkey,"D") and cyclebackward
If (ClipCycleCounter = 1) and (ClipboardPrivate = 1)
Indicator:="*"
If (ClipCycleCounter <> 0)
ttext:=% Chr(96+ClipCycleCounter) Indicator " : " DispToolTipText(History[ClipCycleCounter].text)
{
If (ClipCycleCounter < 27)
ClipCycleCounterIndicator:=Chr(96+ClipCycleCounter)
Else
ClipCycleCounterIndicator:=ClipCycleCounter
ttext:=% ClipCycleCounterIndicator Indicator " : " DispToolTipText(History[ClipCycleCounter].text,,History[ClipCycleCounter].time)
}
else
ttext:="[cancelled]"
If (oldttext <> ttext)
Expand Down Expand Up @@ -352,8 +360,12 @@ While GetKeyState(hk_cyclemodkey,"D") and cycleforward
Indicator:=""
If (ClipCycleCounter = 1) and (ClipboardPrivate = 1)
Indicator:="*"
If (ClipCycleCounter < 27)
ClipCycleCounterIndicator:=Chr(96+ClipCycleCounter)
Else
ClipCycleCounterIndicator:=ClipCycleCounter
If (ClipCycleCounter <> 0)
ttext:=% Chr(96+ClipCycleCounter) Indicator " : " DispToolTipText(History[ClipCycleCounter].text)
ttext:=% ClipCycleCounterIndicator Indicator " : " DispToolTipText(History[ClipCycleCounter].text,,History[ClipCycleCounter].time)
else
ttext:="[cancelled]"
If (oldttext <> ttext)
Expand Down Expand Up @@ -397,16 +409,25 @@ If (ClipCycleCounter = 0) or (ClipCycleCounter = "")
ClipCycleCounter:=1
While GetKeyState(hk_cyclemodkey,"D")
{
If ShowTime
{
time:=History[ClipCycleCounter].time
If TimeFormat and time
{
FormatTime, disptime, %time%, %TimeFormatTime%
disptime := Ltrim(TimeFormatIndicator) disptime " "
}
}
If (ClipCycleCounter <> 0)
ttext:=% "Plugin: " ((CyclePlugins.HasKey(CycleFormat) = "0") ? "[none]" : CyclePlugins[CycleFormat]) CyclePluginsToolTipLine DispToolTipText(History[ClipCycleCounter].text,CycleFormat)
ttext:=% disptime "Plugin: " ((CyclePlugins.HasKey(CycleFormat) = "0") ? "[none]" : CyclePlugins[CycleFormat]) CyclePluginsToolTipLine DispToolTipText(History[ClipCycleCounter].text,CycleFormat)
else
ttext:="Plugin: [cancelled]" CyclePluginsToolTipLine
If (oldttext <> ttext)
{
ToolTip, % ttext, %A_CaretX%, %A_CaretY%
oldttext:=ttext
}

disptime:="",time:=""
Sleep 100
KeyWait, %hk_cycleplugins% ; This prevents the keyboard's auto-repeat feature from interfering.
}
Expand Down Expand Up @@ -648,7 +669,7 @@ Return

DispMenuText(TextIn,lines="1",time="")
{
global MenuWidth,ShowLines,LineTextFormat,ShowTime,TimeFormat
global MenuWidth,ShowLines,LineTextFormat,ShowTime,TimeFormat,TimeFormatIndicator,TimeFormatTime

If (lines=1)
linetext:=LineTextFormat[1]
Expand Down Expand Up @@ -676,22 +697,31 @@ DispMenuText(TextIn,lines="1",time="")
disptime:=""
If TimeFormat and Time
{
FormatTime, disptime, %time%, %TimeFormat%
TextOut .= " " Chr(128336) " " disptime
FormatTime, disptime, %time%, %TimeFormatTime%
TextOut .= TimeFormatIndicator disptime
}
}

Return LTRIM(TextOut," `t")
}

DispToolTipText(TextIn,Format=0)
DispToolTipText(TextIn,Format=0,time=0)
{
Global ShowTime, TimeFormat, TimeFormatIndicator, TimeFormatTime
TextOut:=RegExReplace(TextIn,"^\s*")
TextOut:=SubStr(TextOut,1,750)
;StringReplace,TextOut,TextOut,`;,``;,All
FormatFunc:=StrReplace(CyclePlugins[Format]," ")
If IsFunc(FormatFunc)
TextOut:=%FormatFunc%(TextOut)
If ShowTime
{
If TimeFormat and Time
{
FormatTime, disptime, %time%, %TimeFormatTime%
TextOut := Ltrim(TimeFormatIndicator) disptime "`n" TextOut
}
}
Return TextOut
}

Expand Down
18 changes: 16 additions & 2 deletions lib/settings.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Settings()
IniRead, BackupTimer , %ini%, settings, BackupTimer, 10
IniRead, Exclude , %ini%, settings, Exclude, 0
IniRead, LineFormat , %ini%, settings, LineFormat, \t(\l line),\t(\l lines)
IniRead, TimeFormat , %ini%, settings, TimeFormat, HH:mm
IniRead, TimeFormat , %ini%, settings, TimeFormat, @|HH:mm
IniRead, SettingsFolders , %ini%, settings, SettingsFolders, 0
IniRead, ShowSpecial , %ini%, settings, ShowSpecial , 1
IniRead, ShowTemplates , %ini%, settings, ShowTemplates, 1
Expand All @@ -58,6 +58,20 @@ Settings()
folders:=StrReplace(folders,"%A_" Trim(A_LoopField," ") "%", %tmpfolder%)
}

If InStr(TimeFormat,"|")
{
TimeFormatIndicator:=StrSplit(TimeFormat,"|").1
If TimeFormatIndicator is number
TimeFormatIndicator:=Chr(TimeFormatIndicator)
TimeFormatIndicator:=A_Space TimeFormatIndicator A_Space
TimeFormatTime:=StrSplit(TimeFormat,"|").2
}
Else
{
TimeFormatIndicator:=""
TimeFormatTime:=TimeFormat
}

ClipDataFolder:=StrSplit(folders,";").1 "\ClipData\"
If (ClipDataFolder = "\ClipData\")
ClipDataFolder:=A_ScriptDir "\ClipData\"
Expand Down Expand Up @@ -137,7 +151,7 @@ Settings_Default()
, ShowMorehistory : 1
, ShowExit : 1
, Exclude : ""
, TimeFormat : "HH:mm"
, TimeFormat : "@|HH:mm"
, LineFormat : "\t(\l line),\t(\l lines)" }
}

Expand Down
20 changes: 18 additions & 2 deletions plugins/search.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,22 @@ StartList:=""
for k, v in History
{
add:=v.text
time:=v.time
if ShowLines
linetext:=" - " v.lines
else
linetext:=""

disptime:=""
stringreplace, add, add, |,,All
stringreplace, add, add, `n,%A_Space%,All
StartList .= "[" SubStr("00" A_Index,-2) "] " Add "|"
If ShowTime
If TimeFormat and Time
{
FormatTime, disptime, %time%, %TimeFormatTime%
disptime := Ltrim(TimeFormatIndicator) disptime " "
}
StartList .= disptime "[" SubStr("00" A_Index,-2) linetext "] " Add "|"
}

Gui, Search:Destroy
Expand Down Expand Up @@ -81,7 +94,10 @@ if (Choice = "")
{
ControlGet, Choice, list, , ListBox1, A
}
id:=Ltrim(SubStr(Choice,2,InStr(Choice,"]")-2),"0")
; id:=Ltrim(SubStr(Choice,2,InStr(Choice,"]")-2),"0")
RegExMatch(Choice,"\[0*(\d+)",id)
Id:=id1
id1:=""
if (id = "")
id:=1
ClipText:=History[id].text
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CL3 <sup>v1.107</sup> - Clipboard caching utility
# CL3 <sup>v1.108</sup> - Clipboard caching utility

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

0 comments on commit c9fd447

Please sign in to comment.