Skip to content

Instantly share code, notes, and snippets.

@Lokno
Last active September 27, 2024 21:34
Show Gist options
  • Save Lokno/611cafde6bba4940a6ed2f228560f690 to your computer and use it in GitHub Desktop.
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.
; 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