Format Numbers in AutoHotkey with Commas
- Category: AutoHotkey
- Hits: 15220
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 }
Autohotkey Count Number of Files/Folders in a Directory
- Category: AutoHotkey
- Hits: 15542
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).
Basic Webpage Controls with JavaScript / COM
- Category: AutoHotkey
- Hits: 22216
Source: Jethrow @ Autohotkey Forums
Alternative method of displaying Unicode in Autohotkey GUI
- Category: AutoHotkey
- Hits: 22686
msgbox % Chr(24) ; upwards arrow msgbox % Chr(25) ; downwards arrow, unstable
Add Image Mouseover effect in AutoHotkey GUI
- Category: AutoHotkey
- Hits: 215876
Couldn't find this anywhere on the net and kinda needed it so am making a note of how to do it here.
The issue is that I wanted to make my autohotkey program change the image that the mouse hovers over (within it's own GUI). No third-party component or dll needed, just a slight modification to the mousemove tooltip in the autohotkey manual.
A for loop within a for loop in MS-DOS
- Category: MS-DOS
- Hits: 7782
A quick note for myself as I'd forgotten how to do this (we're talking technology belonging to the 90s - MS-DOS v6.22). The example wants to loop through a directory and then loop through the line it finds.
Why?
I use another technology for automation but sometimes the simpler solution is the one I make for other people to use. Explaining MS-DOS batch programs is a lot easier and colleagues trust these more than my all-in-one GUI applications.
How?
Note: we're using the code in a DOS Batch program so our variables have to be prefixed with a double-percent rather than just the one:
Prefix Line Numbers in a Text File
- Category: MS-DOS
- Hits: 15513
Prefixing lines with their respective line number in a text file using a Microsoft Windows Operating System... I've just googled this as I couldn't remember how I did this last time and a number of people showing off their MS-DOS batch skills have proposed stupid extensive solutions when all you need is one command-line.
Why?
Working with programming languages, I often need to write the accompanying documentation. Within the documentation, I may want to refer to a line of code within a text file. I also find myself copying amounts of code into the same document and then needing lines prefixed so that I can explain the code.
What?
Change contents of "original_file.txt"
The first line of my code The second line of my code The third line of my codeTo "results_file.txt"
1: The first line of my code 2: The second line of my code 3: The third line of my code
How?
MS-DOS: Copy folders without overwriting files
- Category: MS-DOS
- Hits: 18383
A quick note on how to copy files and folders over without overwriting existing files. It's easy to say "Yes" and replace all files. What I need is something that synchronizes files on an internal hard drive to an external one. I wanted it to copy only the files that were new in the original folder and only copy those over (reason being, the archive is 4 terabytes and backing up only the changed files would speed things up).
Applies to:
- Microsoft Windows XP
- Microsoft Windows 7
- Microsoft Windows 8
- for Vista and Windows 2008 without XCOPY, try ROBOCOPY.
How?
We're going to use MS-DOS because I'm that old.
Subcategories
Page 4 of 72