Tuesday, January 29, 2013

Lorem ipsum hotkey

Here's an AutoHotKey script to generate "lorem ipsum" when you press scroll lock. If you press again within a second it also inserts a space and avoids title-casing the word.
SetKeyDelay, -1

lipsum = Lorem ipsum dolor sit amet consectetur adipiscing elit sed et suscipit nunc in egestas velit condimentum nunc egestas feugiat nunc scelerisque tincidunt nisi vitae aliquet in eget tortor mauris sed porttitor velit quisque vehicula pretium rutrum vestibulum nec quam lectus et eleifend nibh morbi placerat facilisis ante quis elementum quisque a lacus velit

StringSplit, lipsum_array, lipsum, %A_Space%

n := 1
t := 0

ScrollLock::
    if n > %lipsum_array0%
    {
        n := 1
    }

    word := lipsum_array%n%

    t2 := DllCall("GetTickCount64")
    if ((t2 - 1000) < t) {
        send {space}
    } else {
        StringUpper, word, word, T
    }

    send %word%

    n := n + 1
    t := DllCall("GetTickCount64")
return