Last active
September 27, 2024 21:34
-
-
Save Lokno/611cafde6bba4940a6ed2f228560f690 to your computer and use it in GitHub Desktop.
Autohotkey script that fills a number sequence 0-n into a text editor vertically. The user is prompted for the range n.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Author: Lokno Ketchup | |
; Description: Autohotkey script that fills a number sequence 0-n into | |
; a text editor vertically. The user is prompted for the range n. | |
; Default Shortcut: Ctrl+N | |
; return the digit count of x | |
CountDigits(x) | |
{ | |
total := 0 | |
Loop | |
{ | |
x := x//10 | |
total += 1 | |
if( x == 0 ) | |
break | |
} | |
return total | |
} | |
^n:: | |
InputBox, n, Fill Number Sequence, Enter Range, , 230, 140 | |
m := CountDigits(n-1) | |
i := 0 | |
Loop, %n% | |
{ | |
l := CountDigits(i) | |
d := m-l | |
Loop, %d% | |
{ | |
Send {Space} | |
} | |
Send %i% | |
Loop, %m% | |
{ | |
Send {Left} | |
} | |
Send {Down} | |
i += 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment