Dear people,
I am lazy. I want to touch my keyboard and mouse as few as possible.
Therefor, I created a script that can type letters for me, so I can Google with only voice commands.
Too bad I am a too big Applescript Noob for it won't work.
I based it on the number typing script on this page.
But it is slightly different for I want to typ it letter for letter, so I can see if I made a mistake.
Here's my script, the error is in the interpretText, but I don't get it. Who will help me?
Thanks in advance!
I am lazy. I want to touch my keyboard and mouse as few as possible.
Therefor, I created a script that can type letters for me, so I can Google with only voice commands.
Too bad I am a too big Applescript Noob for it won't work.
I based it on the number typing script on this page.
But it is slightly different for I want to typ it letter for letter, so I can see if I made a mistake.
Here's my script, the error is in the interpretText, but I don't get it. Who will help me?
Thanks in advance!
Code:
--set up variables
property alphaList : {"Alfa", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliett", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu", "enter", "stop typing"}
set theText to ""
set theInput to ""
--give feedback that we're listening
say "type"
tell application "SpeechRecognitionServer"
repeat until theText is in {"enter", "stop typing"}
--listen for input
set theText to listen for alphaList
--accumulate our input for later processing
if theText is not "stop typing" then
set theInput to interpretText(theText)
tell application "System Events"
keystroke (theInput as text)
end tell
end if
end repeat
end tell
on interpretText(theLetter)
local Letter
set Letter to ""
if theLetter is "Alfa" then
set Letter to "a"
end if
return Letter
end interpretText
-- , "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliett", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu", "enter"