haloshadow Posted January 28, 2007 Share Posted January 28, 2007 (edited) I need help making a start hotkey, I'm rather new to this. Bear with me. I just want to be able to tell the person to press say, F5 to start, and F6 to pause. The ending of the script is fine. expandcollapse popup; Script Function: ; BEER SONG! ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) $answer = MsgBox(4, "Beer Song", "This will sing 100 beer bottles song. Execute?") MsgBox(0, "WARNING","At any time, if you wish to end the autotyping. Press Ctrl+Q.") hotkeyset("^q", "Kill") func Kill() $count = 0 Sleep(3000) Send("Script aborted{!}{ENTER}") EndFunc ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "Awww.....................", "OK. Bye!") Exit EndIf ; Set the counter $count = 500 While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer{!}{!}{!}{ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd ; Finished! Sleep(2000) MsgBox(0, "BeerSong By Haloshadow", "Script ended.") P.S. This is great on runescape... I counted down from 10,000 and had it going FOREVER. It's sad when you get muted because people hate music though. I had all the people dancing. Edited January 28, 2007 by haloshadow Link to comment Share on other sites More sharing options...
Infinitex0 Posted January 28, 2007 Share Posted January 28, 2007 (edited) Havn't messed with autoit in a while but something like CODEMsgBox(0, "B.O.B.", "If at any time you would like to end this simply press F6") Not really sure if this is what you want. Don't really understand your question. P.S. Great idea. EDIT: well, since I felt this was missing something, I added something Now the user can put the number of bottles of beer. Hotkeyset("{F7}", "StartSong") HotKeySet("{F8}", "EndSong") Global $count, $inputA, $delay $count=1 $delay=1 MsgBox(0, "B.O.B.", "This is B.O.B." & @CRLF & "A script that will sing Bottles Of Beer") $inputA=InputBox("B.O.B.", "How many Bottles of beer?") $count = $inputA while $delay=1 sleep(1000) WEnd While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer!!! {ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd Func StartSong() $delay=0 EndFunc Func EndSong() $count=0 EndFunc Edited January 28, 2007 by Infinitex0 The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
Shevilie Posted January 28, 2007 Share Posted January 28, 2007 (edited) You need to change ! to {!} since ! = ALT key Hotkeyset("{F7}", "StartSong") HotKeySet("{F8}", "EndSong") Global $count, $inputA, $delay $count=1 $delay=1 MsgBox(0, "B.O.B.", "This is B.O.B." & @CRLF & "A script that will sing Bottles Of Beer") $inputA=InputBox("B.O.B.", "How many Bottles of beer?") $count = $inputA while $delay=1 sleep(1000) WEnd While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer[b]{!}{!}{!}[/b] {ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd Func StartSong() $delay=0 EndFunc Func EndSong() $count=0 EndFunc Edited January 28, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Infinitex0 Posted January 28, 2007 Share Posted January 28, 2007 uhhh, I did. The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 uhhh, I did. I think Shevilie meant this part: Send("" & $count & " bottles of beer!!! {ENTER}") [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 (edited) Yeah, the "!" symbol has to be closed in brackets. Otherwise it doesn't type it. Edited January 28, 2007 by haloshadow Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 One more quick question, If I were to put delay back to 1, would it pause it? That's mainly what i'm looking for, is something to pause. Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 (edited) One more quick question, If I were to put delay back to 1, would it pause it?That's mainly what i'm looking for, is something to pause.It will stop if count is equal to or less than zero.It will start if delay is equal to zero. So I guess yes. Edited January 28, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 Logic seems corrent, but test results lead otherwise. After the While function is passed you cant go back to it, so changing the value to 1 dosn't work. Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 (edited) Oh that's because the "While delay = 1" loop needs to go after the "While count > 0" loop Really the code needs to be more like this: Hotkeyset("{F7}", "StartSong") HotKeySet("{F8}", "EndSong") Global $count, $inputA, $delay $count=1 $delay=1 MsgBox(0, "B.O.B.", "This is B.O.B." & @CRLF & "A script that will sing Bottles Of Beer") $inputA=InputBox("B.O.B.", "How many Bottles of beer?") $count = $inputA While 1 ; Main While-Loop to keep program alive while $delay=1 sleep(1000) WEnd While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer{!}{!}{!} {ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd WEnd Func StartSong() $delay=0 EndFunc Func EndSong() $count=0 EndFunc Edited January 28, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 Yeah, that's a good idea! Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 (edited) Wait, hold on... Now the script NEVER ends... Should I add gui box? That just has a quit button, and maybe says Script Running/Paused. This is what i've got expandcollapse popupHotkeyset("{F8}", "StartSong") HotKeySet("{F10}", "EndSong") HotKeySet("{F9}", "PauseSong") Global $count, $inputA, $delay $count=1 $delay=1 MsgBox(0, "B.O.B.", "This is BOB." & @CRLF & "A script that will sing Bottles Of Beer on the wall" & @CRLF & "Scripted by §haÐoW - Runescape Version") $inputA=InputBox("B.O.B.", "How many Bottles of beer?") $count = $inputA $wait=InputBox("TimeDelay","Enter the delay time in seconds." & @CRLF & "Recomended Time is 2.2") MsgBox(0, "B.O.B","HotKey Instructions:" & @CRLF & "F8: Start-Song" & @CRLF & "F9: Pause-Song" & @CRLF & "F10: End-Program" & @CRLF & "Don't start the script until you select the window you want.") $wait = $wait * 1000 While 1 ; Main While-Loop to keep program alive while $delay=1 sleep(1000) WEnd While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer{!}{!}{!} {ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd WEnd Func StartSong() $delay=0 EndFunc Func PauseSong() $delay=1 EndFunc Func EndSong() $count=0 MsgBox(0, "B.O.B","You pressed F10, program ended.") EndFunc Edited January 28, 2007 by haloshadow Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 (edited) Wait, hold on... Now the script NEVER ends... Just have an Func with an Exit inside. Example: expandcollapse popupHotkeyset("{F7}", "StartSong") HotKeySet("{F8}", "EndSong") HotKeySet("{F9}","ExitScript") ; New Hot Key Global $count, $inputA, $delay $count=1 $delay=1 MsgBox(0, "B.O.B.", "This is B.O.B." & @CRLF & "A script that will sing Bottles Of Beer") $inputA=InputBox("B.O.B.", "How many Bottles of beer?") $count = $inputA While 1 while $delay=1 sleep(1000) WEnd While $count > 0 Send("Theres " & $count & " bottles of beer on the wall.{ENTER}") Sleep(2200) Send("" & $count & " bottles of beer{!}{!}{!} {ENTER}") Sleep(2200) Send("Take one down, pass it around.{ENTER}") Sleep(2200) $count = $count - 1 WEnd WEnd Func StartSong() $delay=0 EndFunc Func EndSong() $count=0 EndFunc Func ExitScript() Exit ;Exits script EndFunc Edited January 28, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Infinitex0 Posted January 28, 2007 Share Posted January 28, 2007 ........................or click the tray icon. The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 Ok, I see, so exit kills the script. Do you guys have a wikipedia listing the functions or something? That would be nice. Link to comment Share on other sites More sharing options...
haloshadow Posted January 28, 2007 Author Share Posted January 28, 2007 ........................or click the tray icon.Some people are stupid . Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 (edited) Ok, I see, so exit kills the script.Do you guys have a wikipedia listing the functions or something?That would be nice.Functions are in the help file You can search for them by clicking the Index tab. Edited January 28, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Infinitex0 Posted January 28, 2007 Share Posted January 28, 2007 (edited) pretty sure the helpfile comes with the download, just check Start>All Programs>AutoIt3>HelpfileSome people are stupid biggrin.gif. are you callin me stupid or saying that people are to stupid to use the tray icon? Edited January 28, 2007 by Infinitex0 The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
BALA Posted January 28, 2007 Share Posted January 28, 2007 Functions are in the help file You can search for them by clicking the Index tab.Here's a picture: [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Infinitex0 Posted January 28, 2007 Share Posted January 28, 2007 Get used to that image BECAUSE YOU WILL SEE IT MORE THAN ANYTHING ON YOUR COMPUTER. The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now