AutoHotkey Community

It is currently May 27th, 2012, 12:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Doing poetry with AHK
PostPosted: May 16th, 2005, 5:54 pm 
Offline

Joined: April 24th, 2005, 1:04 am
Posts: 97
I thought that would funny: :D :D
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2005, 8:02 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
Image

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

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2005, 8:15 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
oh yeah baby :P
Quote:
If burning AHK-Users are swimming quick
those frightfull virgins should be traveling badly
:lol:

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2005, 10:49 pm 
Offline

Joined: February 14th, 2005, 10:54 am
Posts: 447
Location: Texas, Usa
funny

_________________
my lame sig :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 9:04 pm 
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


Report this post
Top
  
Reply with quote  
PostPosted: February 7th, 2008, 12:35 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2008, 10:43 pm 
Offline

Joined: October 6th, 2007, 2:28 am
Posts: 49
Location: Philadelphia
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2008, 3:39 pm 
This might come in handy for Valentine Day :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2008, 10:57 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
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?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 18th, 2008, 9:46 am 
Offline

Joined: March 18th, 2008, 9:21 am
Posts: 8
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'.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group