#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 ??