Autohotkey Count Number of Files/Folders in a Directory
- Category: AutoHotkey
- Hits: 34539
So this is an article to list methods of retrieving the number of files in a folder/directory.
Why?
Why can't we just use a loop and file pattern native to the Autohotkey programming language:
UserFolder:="C:" -- UserFolder := RegExReplace( MyInputField, "\\$") ; gets rid of trailing slash if required -- Method #1 count := 0 Loop, %UserFolder%\*.*, 0, 1 count++ -- note for future use: ; if A_LoopFileAttrib contains H,R,S ; continueThis works fine at home on your local host on a local drive. Try using this over a networked drive and more time will be spent counting the files then the actual processing (or whatever your script is trying to do).
Alternative method of displaying Unicode in Autohotkey GUI
- Category: AutoHotkey
- Hits: 38746
msgbox % Chr(24) ; upwards arrow msgbox % Chr(25) ; downwards arrow, unstable
Fun with DllCall in AutoHotkey
- Category: AutoHotkey
- Hits: 30584
The one to rule them all:
This is a function I pulled from the Autohotkey forums submitted by SKAN which lists all the functions for a specified Dynamic Link Library (DLL) along with an inputbox for convenience:
Functions to convert Hex 2 RGB and vice-versa
- Category: AutoHotkey
- Hits: 18834
- From Hexadecimal to RGB
- From RGB to Hexadecimal
- Check for a valid hexadecimal value
AutoHotkey Format Date and Format Seconds
- Category: AutoHotkey
- Hits: 26531
In it's straightforward form
FormatTime( TimeString, Format )
{
FormatTime, FormattedTime , TimeString, %Format%
return Formattedtime
}
Format Numbers in AutoHotkey with Commas
- Category: AutoHotkey
- Hits: 22527
FormatAddCommas(val) {
Result:=val
StringLen, OutputVar, Result
NumLoop := (OutputVar // 3)
DNum = 3
Loop, % (NumLoop+1)
{
StringRight,Digit,Result,%DNum%
StringReplace, Result, Result, %Digit%,`,%Digit%
DNum += 4
}
StringLen, OutputVar, Result
Loop, %OutputVar%
{
FirstChar:=Substr(Result, 1, 1)
IfEqual, FirstChar, `,
{
Result:=Substr(Result, 2)
} else {
break
}
}
Return Result
}
Mouseover Links in AutoHotkey
- Category: AutoHotkey
- Hits: 28253
How?
Win32 Constants
- Category: AutoHotkey
- Hits: 70709

