Okay... So i've been playing around with applescript since yesterday as i wait on my objective-c books to come in the mail.......
ANYways. I did all the classic starters (beep test, dialog boxes, etc)...
Well, this evening after like 6 hours of trial and error i finally made my own little program, and i would LOVE your feedback! Before i copy in the code so that you can try it and see what you think, let me explain.
I play a game online where i attack something, then have to wait a long time, then come back and finish the commands... Well, i ofter switch internet windows during this. The problem is that i often get engrossed in this new window and forget my game, which leads to lots of problems losing money and dying and things haha....
SO i wanted a program to act as a timer to remind me of the game..
But i wasnt satisfied with that, i wanted it to be voice controlled, which is what took so long.... I only wanted to have to open it once, so i had to figure out how to implement a repeating loop in the program... THEN i wanted it to close itself based on a voice command as well (which was confusing because of the looping....) Frankly i think that this way of ending the program is fairly ingenious... i couldnt find anything like it online haha.
ANYhow. I finally think i got it! It's only a couple of lines long, and obviously super simple... so im kinda embarassed that it took so many hours haha, but then again it works great for me so im happy to have made my first useful program!
Below is the code. Please paste it into script editor, and then save it as an application (named myGameTimer )to your desktop to try it out (because of the way i put in a voice-command-shutdown, script editor thinks its an error so you cant just run it from the editor. but it works great once you save it to an app file)
with timeout of 1800 seconds
repeat
tell application "SpeechRecognitionServer"
set theResponse to listen for {"Thank You", "towers timer", "quit timer"}
if theResponse is "Thank You" then
say "You're Welcome"
else if theResponse is "towers timer" then
tell application "Finder"
delay 5
say "Ryan, please check your game status."
end tell
else if theResponse is "quit timer" then
tell application "myGameTimer"
activate
end tell
tell application "System Events"
keystroke "." using {command down}
end tell
end if
end tell
end repeat
end timeout
OK... So there it is. Basically you start it, and then you can say "towers timer" to start the timer, and "Thank you" to thank the machine as often as you want interchangably... then "quit timer" whenever you are done. I put the longer timout cause it kept stopping during gameplay, and as a side note i usually have the "delay 5" as "delay 45" since that is about the time i need for the game....
So what do you think lol? Don't be too mean ^^
P.S. Edited to add "activate myGameTimer" section... before you had to click the icon before saying "quit timer"... Now you can just say it while surfing the web or whatever haha... So make sure you title it myGameTimer when you save it to your desktop as an app.
ANYways. I did all the classic starters (beep test, dialog boxes, etc)...
Well, this evening after like 6 hours of trial and error i finally made my own little program, and i would LOVE your feedback! Before i copy in the code so that you can try it and see what you think, let me explain.
I play a game online where i attack something, then have to wait a long time, then come back and finish the commands... Well, i ofter switch internet windows during this. The problem is that i often get engrossed in this new window and forget my game, which leads to lots of problems losing money and dying and things haha....
SO i wanted a program to act as a timer to remind me of the game..
But i wasnt satisfied with that, i wanted it to be voice controlled, which is what took so long.... I only wanted to have to open it once, so i had to figure out how to implement a repeating loop in the program... THEN i wanted it to close itself based on a voice command as well (which was confusing because of the looping....) Frankly i think that this way of ending the program is fairly ingenious... i couldnt find anything like it online haha.
ANYhow. I finally think i got it! It's only a couple of lines long, and obviously super simple... so im kinda embarassed that it took so many hours haha, but then again it works great for me so im happy to have made my first useful program!
Below is the code. Please paste it into script editor, and then save it as an application (named myGameTimer )to your desktop to try it out (because of the way i put in a voice-command-shutdown, script editor thinks its an error so you cant just run it from the editor. but it works great once you save it to an app file)
with timeout of 1800 seconds
repeat
tell application "SpeechRecognitionServer"
set theResponse to listen for {"Thank You", "towers timer", "quit timer"}
if theResponse is "Thank You" then
say "You're Welcome"
else if theResponse is "towers timer" then
tell application "Finder"
delay 5
say "Ryan, please check your game status."
end tell
else if theResponse is "quit timer" then
tell application "myGameTimer"
activate
end tell
tell application "System Events"
keystroke "." using {command down}
end tell
end if
end tell
end repeat
end timeout
OK... So there it is. Basically you start it, and then you can say "towers timer" to start the timer, and "Thank you" to thank the machine as often as you want interchangably... then "quit timer" whenever you are done. I put the longer timout cause it kept stopping during gameplay, and as a side note i usually have the "delay 5" as "delay 45" since that is about the time i need for the game....
So what do you think lol? Don't be too mean ^^
P.S. Edited to add "activate myGameTimer" section... before you had to click the icon before saying "quit timer"... Now you can just say it while surfing the web or whatever haha... So make sure you title it myGameTimer when you save it to your desktop as an app.