AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Doing poetry with AHK

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Rubberduck



Joined: 24 Apr 2005
Posts: 96

PostPosted: Mon May 16, 2005 5:54 pm    Post subject: Doing poetry with AHK Reply with quote

I thought that would funny: Very Happy Very Happy
Code:

#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.autohotkey.com/docs/Scripts.htm#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.
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Mon May 16, 2005 8:02 pm    Post subject: Reply with quote



Quote:
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

_________________
Back to top
View user's profile Send private message
TeknoMusicMan



Joined: 14 Apr 2005
Posts: 188
Location: Wisconsin, USA

PostPosted: Mon May 16, 2005 8:15 pm    Post subject: Reply with quote

oh yeah baby Razz
Quote:
If burning AHK-Users are swimming quick
those frightfull virgins should be traveling badly
Laughing
_________________

"Make it idiot-proof, and someone will make a better idiot."
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon May 16, 2005 10:49 pm    Post subject: Reply with quote

funny
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
stakko
Guest





PostPosted: Thu Jun 16, 2005 9:04 pm    Post subject: Reply with quote

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
Back to top
X_x
Guest





PostPosted: Thu Feb 07, 2008 12:35 pm    Post subject: Re: Doing poetry with AHK Reply with quote

Rubberduck wrote:

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.autohotkey.com/docs/Scripts.htm#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:
Code:
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:
Code:
if (Color = "Red" or Color = "Green"  or Color = "Blue" or Color = "Black" or Color = "Gray" or Color = "White") and ProductIsAvailableInColor(Product, Color)

also
Code:
123,234,345,456,567 ;comment
   ,678,789,890
will become
Code:
123,234,345,456,567,678,789,890
Back to top
williamsharkey



Joined: 06 Oct 2007
Posts: 52
Location: Philadelphia

PostPosted: Thu Feb 07, 2008 10:43 pm    Post subject: Reply with quote

Code:
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
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Fri Feb 08, 2008 3:39 pm    Post subject: Reply with quote

This might come in handy for Valentine Day Wink
Back to top
automaticman



Joined: 27 Oct 2006
Posts: 322

PostPosted: Wed Feb 20, 2008 10:57 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
jfty.009260



Joined: 18 Mar 2008
Posts: 8

PostPosted: Tue Mar 18, 2008 9:46 am    Post subject: sample product of this here script Reply with quote

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'.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group