Skip to content

Instantly share code, notes, and snippets.

@0x4a
Last active March 29, 2022 19:10
Show Gist options
  • Save 0x4a/5932300 to your computer and use it in GitHub Desktop.
Save 0x4a/5932300 to your computer and use it in GitHub Desktop.
use total commander script content plugin with autohotkey scriptsplace files in directory of installed script.wdx, add columns with "[=script.Result]" which will show line number of files - counted by ahk script #totalcmd #ahk
; requires WinScript Advanced Content Plugin for Total Commander: http://totalcmd.net/plugring/WinScriptAdv.html
#NoEnv
#NoTrayIcon
FileEncoding UTF-8
SetBatchLines,-1
file = %filename%
; find file
if FileExist(file)
{
; check size
FileGetSize, fileSize, %file%
if (fileSize < 1000000)
{
returnValue := countLines(file)
}
else
{
returnValue := "---"
}
}
else if StrLen(file) = 0
{
; missing argument
returnValue := -1
}
else
{
; file not found
returnValue := -1
}
;Msgbox, (%returnValue%) %file%
if (returnValue = "" or returnValue = -1) {
content = 0
} else {
content = %returnValue%
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; file functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; return number of lines
countLines(file)
{
Loop, read, %file%
lineCount := A_Index
return lineCount
}
[Lines]
Script=lines.ahk
content=Number of lines
extensions=*
FoldersPaths=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment