99 Bottles of Beer/Shell: Difference between revisions
Content added Content deleted
m (moving code from main task-page to sub-page) |
(AutoHotkey) |
||
Line 1: | Line 1: | ||
=Task in Shell(s)= |
<!-- =Task in Shell(s)= --> |
||
{{collection|99 Bottles of Beer}} [[implementation of task::99 Bottles of Beer| ]] |
{{collection|99 Bottles of Beer}} [[implementation of task::99 Bottles of Beer| ]] |
||
[[99 Bottles of Beer]] done in any of the Shell-languages. |
[[99 Bottles of Beer]] done in any of the Shell-languages. |
||
__toc__ |
__toc__ |
||
=={{header|AutoHotkey}}== |
|||
<lang AutoHotkey>; RC: 99 bottles of beer |
|||
b = 99 |
|||
Loop, %b% { |
|||
s .= b . " bottles of beer on the wall,`n" |
|||
. b . " bottles of beer.`nTake one down, pass it around,`n" |
|||
. b-1 . " bottles of beer on the wall.`n`n" |
|||
b-- |
|||
} |
|||
Gui, Add, Edit, w200 h200, %s% |
|||
Gui, Show, , 99 bottles of beer |
|||
Return ; end of auto-execute section |
|||
GuiClose: |
|||
ExitApp |
|||
Return</lang> |
|||
Delayed Sing along |
|||
<lang AutoHotkey>n=99 |
|||
Gui, Font, s20 cMaroon, Comic Sans MS |
|||
Gui, Add, Text, w500 vLyrics, %n% bottles of beer on the wall... |
|||
Gui, Show |
|||
Loop { |
|||
Sleep, 2000 |
|||
GuiControl,,Lyrics,% n!=1 ? n " bottles of beer.":n " bottle of beer." |
|||
Sleep, 2000 |
|||
GuiControl,,Lyrics,% n ? "Take one down, pass it around...":"Go to the store, buy some more..." |
|||
Sleep, 2000 |
|||
n := n ? --n:99 |
|||
GuiControl,,Lyrics,% n!=1 ? n " bottles of beer on the wall.":n " bottle of beer on the wall." |
|||
Sleep, 2000 |
|||
GuiControl,,Lyrics,% n!=1 ? n " bottles of beer on the wall...":n " bottle of beer on the wall..." |
|||
} |
|||
GuiClose: |
|||
ExitApp</lang> |
|||
Fast and Short |
|||
<lang AutoHotkey>b=99 |
|||
Loop, %b% { |
|||
s := b " bottles of beer on the wall, " b " bottles of beer, Take one down, pass it around " b-1 " bottles of beer on the wall" |
|||
b-- |
|||
TrayTip,,%s% |
|||
sleep, 40 |
|||
}</lang> |
|||
With a GUI and slight grammatical variation: |
|||
<lang AutoHotkey>N=o more |
|||
Z=99 |
|||
L:=Z M:=(B:=" bottle")"s" |
|||
Loop 99 |
|||
V.=L (W:=(O:=" of beer")" on the wall")",`n"L O ",`nTake one down and pass it around,`n"(L:=(--Z ? Z:"N"N)(Z=1 ? B:M))W ".`n`n" |
|||
Gui,Add,Edit,w600 h250,% V L W ", n"N M O ".`nGo to the store and buy some more, 99"M W "." |
|||
Gui,Show |
|||
Return |
|||
GuiClose: |
|||
ExitApp</lang> |
|||
=={{header|Batch File}}== |
=={{header|Batch File}}== |