Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Doing poetry with AHK


  • Please log in to reply
9 replies to this topic
Rubberduck
  • Members
  • 97 posts
  • Last active: Jul 30 2005 12:17 AM
  • Joined: 24 Apr 2005
I thought that would funny: :D :D
#SingleInstance ignore
gui, color, FFFFFF
gui, add, text, x10 y10,Poetry done by AHK
gui, add, button, x10 y30,Do Poetry
gui, add, button, x10 y60,Quit Poetry
gui, show

prio_list = When,If
adje_list = burning,frightfull,beautyful,violent,high,heavy,evil,clever,ingenious,deceitful,ugly,tiny,poor,silly,deep,green,small,loyal,portable,honest,fearless
subs_list = flowers,teachers,melones,swords,knights,dragons,virgins,people,vegetables,fruits,programmers,AHK-Users,rubberducks,idiots,deers,thougts,poets,George.W.Bush's,preachers
verb_list = having sex,falling,looking,beating,fighting,dancing,growing,seeing,crawling,dying,writing poetry,programming,heeding,digging,traveling,learning,bleeding,talking,swimming,writing AHK scripts
conc_list = must be,are trying,should be,are
ends_list = badly,slow,fast,like in dreams,in the castle,noble,nasty,sorrowfull,quick,lonely,on beams,like in heaven
seco_list = those,all,every,the,millions of
StringSplit, prio_Arr, prio_list,`,
StringSplit, adje_Arr, adje_list,`,
StringSplit, subs_Arr, subs_list,`,
StringSplit, verb_Arr, verb_list,`,
StringSplit, conc_Arr, conc_list,`,
StringSplit, ends_Arr, ends_list,`,
StringSplit, seco_Arr, seco_list,`,
prio_count = %prio_Arr0%
adje_count = %adje_Arr0%
subs_count = %subs_Arr0%
verb_count = %verb_Arr0%
conc_count = %conc_Arr0%
ends_count = %ends_Arr0%
seco_count = %seco_Arr0%
act_prio = 0
act_adje = 0
act_subs = 0
act_verb = 0
act_conc = 0
act_ends = 0
act_seco = 0
return

rand_nr(From,To)
{
   random, rand, From, To
   return rand
}

do_poetry(LineCount)
{
  global
  OutPut =
  loop, %LineCount%
  {
     act_prio := rand_nr(1,prio_count)
     act_adje := rand_nr(1,adje_count)
     act_subs := rand_nr(1,subs_count)
     act_verb := rand_nr(1,verb_count)
     act_ends := rand_nr(1,ends_count)
     P1 := prio_Arr%act_prio%
     A1 := adje_Arr%act_adje%
     S1 := subs_Arr%act_subs%
     V1 := verb_Arr%act_verb%
     E1 := ends_Arr%act_ends%
     loop
     {
       act_prio := rand_nr(1,prio_count)
       act_adje := rand_nr(1,adje_count)
       act_subs := rand_nr(1,subs_count)
       act_verb := rand_nr(1,verb_count)
       act_ends := rand_nr(1,ends_count)
       P2 := prio_Arr%act_prio%
       A2 := adje_Arr%act_adje%
       S2 := subs_Arr%act_subs%
       V2 := verb_Arr%act_verb%
       E2 := ends_Arr%act_ends%
       ; Here would be the right place to check for ryhme-words   
       ; e.g. by checking if E1 and E2 are ending with the same letters
       if (P1<>P2) and (A1<>A2) and (S1<>S2) and (V1<>V2) and (E1<>E2) 
         break
     }
     act_conc := rand_nr(1,conc_count)
     C1 := conc_Arr%act_conc%
     act_seco := rand_nr(1,seco_count)
     H1 := seco_Arr%act_seco%
     OutPut=%OutPut%`n%P1% %A1% %S1% are %V1% %E1%`n%H1% %A2% %S2% %C1% %V2% %E2%`n 
  }
  return OutPut
}

ButtonDoPoetry:
Poetry := do_poetry(8)
MsgBox, %Poetry% 
return

Esc::
ButtonQuitPoetry:
ExitApp

Of course this script is simple, but it produces sometimes really funny poetry. English is not my mother language, so if there is anybody that could improve this script e.g. by selecting better words.

If you want to write a more powerfull version, then it should be able to find words that rhyme at the end of two lines. Also its easy to change the script to send the lines to notepad, or read the words it uses from in INI-File.

If you like to post a better version do so.

Edit: When looking at my script in the forum there appears a horizontal
scrollbar in the browser, because I have long lines in the script.
I have read something here:
http://www.autohotke...tm#continuation
but have not understand it.

How do I break up the long lines in the script to several shorter lines ??
Wer keine Antworten hat muss nicht dumm sein,
dumm ist nur der welcher keine Fragen hat.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
Posted Image

If clever AHK-Users are bleeding slow
every beautyful rubberducks must be writing poetry lonely

If small knights are swimming slow
those heavy people are writing AHK scripts nasty

If ugly fruits are crawling slow
those green deers are writing AHK scripts badly


MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


TeknoMusicMan
  • Members
  • 186 posts
  • Last active: Jan 17 2007 10:17 PM
  • Joined: 14 Apr 2005
oh yeah baby :p

If burning AHK-Users are swimming quick
those frightfull virgins should be traveling badly

:lol:
Posted Image
"Make it idiot-proof, and someone will make a better idiot."

Invalid User
  • Members
  • 447 posts
  • Last active: Mar 27 2012 01:04 PM
  • Joined: 14 Feb 2005
funny
my lame sig :)

stakko
  • Guests
  • Last active:
  • Joined: --
When ugly preachers are falling like in heaven
those green virgins are writing AHK scripts badly

If frightfull vegetables are swimming quick
those fearless fruits are falling like in dreams

When honest flowers are swimming fast
the small George.W.Bush's should be crawling quick

X_x
  • Guests
  • Last active:
  • Joined: --

Edit: When looking at my script in the forum there appears a horizontal
scrollbar in the browser, because I have long lines in the script.
I have read something here:
http://www.autohotke...tm#continuation
but have not understand it.

How do I break up the long lines in the script to several shorter lines ??


from what I gather:
if (Color = "Red" or Color = "Green"  or Color = "Blue"
    or Color = "Black" or Color = "Gray" or Color = "White")  ;comment
    and ProductIsAvailableInColor(Product, Color)
will become:
if (Color = "Red" or Color = "Green"  or Color = "Blue" or Color = "Black" or Color = "Gray" or Color = "White") and ProductIsAvailableInColor(Product, Color)
also
123,234,345,456,567 ;comment
   ,678,789,890
will become
123,234,345,456,567,678,789,890


williamsharkey
  • Members
  • 49 posts
  • Last active: Mar 14 2013 06:16 AM
  • Joined: 06 Oct 2007
prio_list =Yes-,When,If,While,With,No-,Behold,See,Great is,Wonderful is,Lo;,Ever,Where can I find,Look:,I searched,I found,... And



arts_list =the,one



adje_list =burning,beautiful,violent,heavy,tiny,poor,eccentric,deep,green,small,loyal,portable,honest,fearless,opulent,native,wet,cold,intense,homeless,placid,calm,cool,blue,mindfull,dull,spiritual,dark,crashing,felt,cotton,wooden,tin,copper,empty,lone,enchanted,nightime,electric,kind,putative,patient,Moog,analogue,solar,impossible,abortive,grey,milky,slumbering,deftly,dark,unmoving,paper,drying,forgotten







subs_list =flower,teacher,melone,virgin,citizen,fruit,youth,deer,thougt,poet,theologian,schoolteacher,preacher,box,idea,word,sound,utterance,mind,song,music box,mouse,glimmer,speck,pool,snowfall,heart,soul,vicar,breast,bosom,firework,firefly,tale,monk,wave,swell,hand,tide,flesh,moon,star,beacon,bee,egg,searcher,sleeper,cigarette,chimera,shadow,orca,airship,tower,body,sketch,nothing,something,coin,Earth,diatribe,inquisition,banana,math,map,liquid,way,number,zero,repeater,dial,sundry,slumber,peasant,pocket watch,dirge,raft,wrath,bud,sand,salt,wayfairer,midwife



verb_list =masking life,failing,looking,beating,fighting,dancing,growing,seeing,steering,crawling,dying,heeding,dredged,traveling,etching,talking,swimming,drinking,gulping,clasping,drooping,thining,digging,beating,glowing,bursting,crashing,releasing,enlightened,hovering,sinking,sulking,harrowing,quivering,shivering,lying awake,singing,thrashing,melting,sewing,milking,repeating,folding,pouring,dipping,wandering,winding



conc_list =must be,should be,is,perhaps should be,never is,cannot be



ends_list =above,over,as in dreams,pass sundown,over,in silence,on the hill,noble,smoke,purfume,alone,on beams,on drums,on the lake,upstream,over your shoulder,like in heaven,under the deep wood,in the village,like a boy,twice,at dusk,not ever,at noon,for tomorrow,on film,with deep swelling,intricacies,into knots,from space,in daylight,to shadowland,in daydream,to windows,for,down pipedreams,unquestioning,as ever,in darkness,in my memory,diaphanously,- speachless,only,against,against flesh,cannot be,on Pleiades,posthumously,past nighttime,in twilight,into heaven,-almost heaven,in absence,- tragedy,in Paris



seco_list =no,not one,that,the,the solitary,a scant,the more,the less,the same,perhaps the,alas the



StringSplit, prio_Arr, prio_list,`,

StringSplit, arts_Arr, arts_list,`,

StringSplit, adje_Arr, adje_list,`,

StringSplit, subs_Arr, subs_list,`,

StringSplit, verb_Arr, verb_list,`,

StringSplit, conc_Arr, conc_list,`,

StringSplit, ends_Arr, ends_list,`,

StringSplit, seco_Arr, seco_list,`,



prio_count = %prio_Arr0%

arts_count = %arts_Arr0%

adje_count = %adje_Arr0%

subs_count = %subs_Arr0%

verb_count = %verb_Arr0%

conc_count = %conc_Arr0%

ends_count = %ends_Arr0%

seco_count = %seco_Arr0%



act_prio = 0

act_arts = 0

act_adje = 0

act_subs = 0

act_verb = 0

act_conc = 0

act_ends = 0

act_seco = 0





rand_nr(From,To)

{

   random, rand, From, To

   return rand

}



do_poetry(LineCount)

{

  global

  OutPut =

  loop, %LineCount%

  {

     act_prio := rand_nr(1,prio_count)

     act_arts := rand_nr(1,arts_count)

     act_adje := rand_nr(1,adje_count)

     act_subs := rand_nr(1,subs_count)

     act_verb := rand_nr(1,verb_count)

     act_ends := rand_nr(1,ends_count)

     P1 := prio_Arr%act_prio%

     T1 := arts_Arr%act_arts%

     A1 := adje_Arr%act_adje%

     S1 := subs_Arr%act_subs%

     V1 := verb_Arr%act_verb%

     E1 := ends_Arr%act_ends%

     loop

     {

       act_prio := rand_nr(1,prio_count)

       act_arts := rand_nr(1,arts_count)

       act_adje := rand_nr(1,adje_count)

       act_subs := rand_nr(1,subs_count)

       act_verb := rand_nr(1,verb_count)

       act_ends := rand_nr(1,ends_count)

       P2 := prio_Arr%act_prio%

       T2 := arts_Arr%act_arts%

       A2 := adje_Arr%act_adje%

       S2 := subs_Arr%act_subs%

       V2 := verb_Arr%act_verb%

       E2 := ends_Arr%act_ends%

       ; Here would be the right place to check for ryhme-words   

       ; e.g. by checking if E1 and E2 are ending with the same letters

       if (P1<>P2) and (A1<>A2) and (S1<>S2) and (V1<>V2) and (E1<>E2)

         break

     }

     act_conc := rand_nr(1,conc_count)

     C1 := conc_Arr%act_conc%

     act_seco := rand_nr(1,seco_count)

     H1 := seco_Arr%act_seco%

     H1S:=SubStr(H1, 1, 1)

     H1F:=SubStr(H1, 2)

     StringUpper, H1S, H1S

     H1:=H1S . H1F

     OutPut=%OutPut%`n%P1% %T1% %A1% %S1%, %V1% %E1%`n%H1% %A2% %S2% %C1% %V2% %E2%`.`n

  }

  return OutPut

}



Poetry := do_poetry(6)

MsgBox, %Poetry%

ExitApp


  • Guests
  • Last active:
  • Joined: --
This might come in handy for Valentine Day :wink:

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
I didn't test your code, but have a question or suggestion as you want to see it.
? Can your code also be used to apply it onto something like this here?

jfty.009260
  • Members
  • 8 posts
  • Last active: Jul 31 2008 02:49 PM
  • Joined: 18 Mar 2008
If evil poets are beating slow
every violent rubberducks are falling like in heaven

When clever AHK-Users are learning lonely
the heavy teachers must be having sex quick

If burning rubberducks are swimming fast
every deceitful virgins must be traveling like in heaven

When ingenious rubberducks are seeing noble
every fearless virgins must be traveling nasty

When silly preachers are seeing in the castle
all poor idiots are digging badly

If honest preachers are dancing on beams
all evil people are bleeding lonely

When tiny teachers are swimming on beams
the ingenious melones must be bleeding sorrowfull

When small fruits are digging sorrowfull
every tiny virgins are crawling badly


Totally random but funny.

BTW, 'sorrowfull' should be 'sorrowful'.