Something cute I made after 3 days of AHK :)

Post your working scripts, libraries and tools for AHK v1.1 and older
Noam527
Posts: 83
Joined: 08 Aug 2016, 17:20

Something cute I made after 3 days of AHK :)

11 Aug 2016, 10:10

You've probably seen people doing stuff like:
a
am
ama
amaz
amazi
amazin
amazing

I saw one of my friends doing this manually today, and I told him that I'm learning AHK and I can use it to automate that.
So I just finished it! it's working great, so I thought I should share it here too.

Code: Select all

var := 1

Sentence = <insert sentence here>

Loop, Parse, Sentence
index := A_index
Return

\::
Sendinput, {Home}
Loop %index%
{
Sendinput, {Shift down}{Right %var%}{Shift up}
Sleep, 15
Sendinput, {Ctrl down}c{Ctrl up}{Down %var%}{End}{Enter}{Ctrl down}v{Ctrl up}{Up %var%}{Home}
var++
Sleep, 30
}
Sendinput, {Up %index%}{End}{BS %index%}
Sleep, 50
Msgbox, Done!
Return

Esc::ExitApp
Some stuff to note:
1) without those "Sleep"'s in the middle it didn't work for me... gotta give the script some rest I guess :P .
2) here are the super easy instructions to use it:

I. at the start of the script you can see: "Sentence = <Insert sentence here>". Just as it says, you pick the sentence that you want to do it to, and write it instead of the '<insert sentence here>'. After doing so, you save the script and run it.
II. You open a notepad (you don't have to open notepad, but I prefer doing so), write the same sentence again, and then you only need to click '/' (that's where the question mark is at), and you'll see magic happening in front of your eyes :) .

Tell me how it did for you! that's the first script I publish.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Something cute I made after 3 days of AHK :)

11 Aug 2016, 16:57

It doesn't work every time, it pasted my current clipboard first time I ran it. Check out, strlen, Clipboard and ClipWait.

This is a more reliable version, but I have to say that your version is really elaborate, well done.

Code: Select all

Sentence=STAIRWAYTOHEAVEN
tmp:=Clipboardall
Clipboard:=""
Loop, % strlen(Sentence)
	Clipboard.=SubStr(Sentence, 1,A_Index) "`n"
Send,^v
Clipboard:=tmp
Edit: I did another one, sigh.
Spoiler
p3trus
Posts: 137
Joined: 02 Aug 2016, 03:20

Re: Something cute I made after 3 days of AHK :)

26 Aug 2016, 13:58

hehe .. that reminds me of of one of my first AHK scripts (dated back around 2007/2008) :D

On a game related forum we had a thread in the off topic section with a little game, "shook up words" - someone posted a long word (or a well known term) - but with all characters sorted alphabetically, everyone could guess the original word; and whoever succeeded posted the next riddle.

eg. if the term was 'Grand Prix', the riddle phrase was ' adGinPrrx'
To simplify the process of checking an own guess or to post a new riddle, I made the following tiny script:

Code: Select all

Gui, Add, Edit, r1 w150 -wrap gEing vinp, Text zum schütteln		; ~ text to shake
Gui, Add, Edit, r1 xp+160 w40 -wrap readonly center vct,
Gui, Add, Edit, r1 x10 w150 -wrap readonly voutp,
Gui, Add, Button, r1 xp+160 w40 -wrap default gKop, &Copy
Gui, Show, x131 y91, Schüttler			; ~ shaker
Return

GuiClose:
ExitApp

Eing:
Gui, Submit, NoHide
outp := ""
ct := StrLen(inp)
Loop, parse, inp
    outp .= A_LoopField "`n"
Sort, outp, CL
StringReplace, outp, outp, `n, , All
GuiControl,, outp, %outp%
GuiControl,, ct, %ct%
Return

Kop:
Clipboard := outp
Return
iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: Something cute I made after 3 days of AHK :)

26 Aug 2016, 21:48

Aesthetic (Vaporwave Text, better known as Full Width characters)

Code: Select all

#j:: Aesthetic()

      Aesthetic(data := "") {
         Sentence := (data == "") ? copy() : data
         Loop, % strlen(Sentence)
         {
            character := Ord(SubStr(Sentence, A_Index, 1))
            aesthetic .= (character >= 0x21 && character <= 0x7f) ? Chr(character + 0xFEE0) : ""
            aesthetic .= (character == 0x3000) ? Chr(0x20) : ""
            aesthetic .= (character >= 0xff01 && character <= 0xff5f) ? Chr(character - 0xFEE0) : ""
            aesthetic .= ((!(character >= 0x21 && character <= 0x7f)) && (!(character >= 0xff01 && character <= 0xff5f)) && (!(character == 0x3000))) ? Chr(character) : ""
         }
         return (data == "") ? paste(aesthetic) : aesthetic
      }
      
      Copy() {
      AutoTrim Off
      c := ClipboardAll
      Clipboard := ""             ; Must start off blank for detection to work.
      Send, ^c
      ClipWait 1
      if ErrorLevel
         return
      t := Clipboard
      Clipboard := c
      VarSetCapacity(c, 0)
      return t
   }

   Paste(t) {
      Highlight.last := Highlight.UnicodeStrLen(t) - 1
      c := ClipboardAll
      Clipboard := t
      Send, ^v
      Sleep 50                    ; Don't change clipboard while it is pasted! (Sleep > 0)
      Clipboard := c
      VarSetCapacity(c, 0)        ; Free memory
      AutoTrim On
   }
Just Highlight some text and press windows + j. It's reversible!
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Something cute I made after 3 days of AHK :)

27 Aug 2016, 08:01

p3trus wrote:hehe .. that reminds me [...]
I have to admit, I kind of like these types of silly things :)
iseahound wrote:[...]
Cool script!
p3trus
Posts: 137
Joined: 02 Aug 2016, 03:20

Re: Something cute I made after 3 days of AHK :)

27 Aug 2016, 09:07

iseahound wrote:Aesthetic (Vaporwave Text, better known as Full Width characters)

Code: Select all

	...
	aesthetic .= (character == 0x3000) ? Chr(0x20) : ""
	...
Nice one! :thumbup:

Is there any reason why you convert that 0x3000 IDEOGRAPHIC SPACE 'back', but never forth? (no aesthetic .= (character == 0x20) ? Chr(0x3000) : "")

...and you should note the need for unicode support in both AHK and OS/ used font - might be valuable to the basic user :lol:
iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: Something cute I made after 3 days of AHK :)

27 Aug 2016, 10:37

I used to include that extra line but commented it out. It's due to how the aesthetic meme is displayed, e.g. Aesthetic Memes has a 0x20 space between c and M. Of course if anyone actually wants to convert ascii into full width feel free to add that line in.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: burque505 and 135 guests