AutoHotkey Community

It is currently May 27th, 2012, 10:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: January 10th, 2007, 5:11 pm 
Hi --

I'm trying to make AutoHotKey speak each letter (or number) after it is typed. Here's what I have for the code so far:

Code:
; Speak letters
keysSpeak = -qwertyuiop[]\asdfghjkl'zxcvbnm=
Loop Parse, keysSpeak
{
   HotKey %A_LoopField%, Speak
}
Speak:
TEMPFILE = %TEMP%\TALK.vbs
IfExist, %TEMPFILE%
   FileDelete, %TEMPFILE%
FileAppend, Dim Talk`nSet Talk =

WScript.CreateObject("SAPI.SpVoice")`nTalk.Speak "%A_ThisHotKey%",

%TEMPFILE%
RunWait, %TEMPFILE%
FileDelete, %TEMPFILE%
Return


There are several problems with this code:
* I cannot run the other AutoHotKey scripts I have programmed after the letter is spoken.
* The characters I'm typing are intercepted by AutoHotKey and what I really want is for the characters to just "pass through" AutoHotKey.
* It seems inefficient to create a vbs file for every character typed. Obviously, I don't want the speech to slow down how fast I'm allowed to type, if at all possible.

I'm a newbie with AutoHotKey scripts, so I'm sure there's a better way to do this... Any suggestions/code changes would be greatly appreciated!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:19 pm 
Code:
; Speak letters
keysSpeak = -qwertyuiop[]\asdfghjkl'zxcvbnm=
Loop Parse, keysSpeak
{
   HotKey %A_LoopField%, Speak ; I doubt that this will work
   }

Speak:
TEMPFILE = %TEMP%\TALK.vbs
IfExist, %TEMPFILE%
   FileDelete, %TEMPFILE%
FileAppend,
(Join
Dim Talk`nSet Talk =
WScript.CreateObject("SAPI.SpVoice")`nTalk.Speak "%A_ThisHotKey%"
), %TEMPFILE%
RunWait, %TEMPFILE%
FileDelete, %TEMPFILE%
Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:21 pm 
:shock: Sorry. :oops:
Code:
FileAppend,
(
Dim Talk
Set Talk = WScript.CreateObject("SAPI.SpVoice")
Talk.Speak "%A_ThisHotKey%"
), %TEMPFILE%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:29 pm 
Thanks for responding, but that code didn't do anything...?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:31 pm 
Indeed as it's the corrected part of the previous one.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:43 pm 
Code:
Loop Parse, keysSpeak
{
   HotKey ~%A_LoopField%, Speak
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 5:50 pm 
nick (n-l-i) wrote:
Code:
Loop Parse, keysSpeak
{
   HotKey ~%A_LoopField%, Speak
}


Thanks, Nick -- that helped.

Here's the code right now:

Code:
; Speak letters
keysSpeak = QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm=
Loop Parse, keysSpeak
{
   HotKey ~%A_LoopField%, Speak
}
Speak:
TEMPFILE = %TEMP%\TALK.vbs
IfExist, %TEMPFILE%
  FileDelete, %TEMPFILE%
FileAppend, Dim Talk`nSet Talk =WScript.CreateObject("SAPI.SpVoice")`nTalk.Speak "%A_ThisHotKey%",%TEMPFILE%
RunWait, %TEMPFILE%
FileDelete, %TEMPFILE%
Return


The problem I have right now is that if I type too fast. I'll get a Windows Script Error (the speech is really lagging behind my usual typing speed).

Is there a way to speed up the speech?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 6:24 pm 
Actually, I got the speech to speed up... The response is still pretty sluggish, though...

Code:
; Speak letters
keysSpeak = QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm="<>.,()!?
Loop Parse, keysSpeak
{
   HotKey ~%A_LoopField%, Speak
}
Speak:
TEMPFILE = %TEMP%\TALK.vbs
IfExist, %TEMPFILE%
  FileDelete, %TEMPFILE%
FileAppend, Dim Talk`nSet Talk =WScript.CreateObject("SAPI.SpVoice")`nTalk.Rate=10`nTalk.Speak "%A_ThisHotKey%",%TEMPFILE%
RunWait, %TEMPFILE%
FileDelete, %TEMPFILE%
Return

; Fix two CApital letters at the beginning of a word.
keys = -qwertyuiop[]\asdfghjkl'zxcvbnm=
Loop Parse, keys
   HotKey ~+%A_LoopField%, Hoty
Hoty:
   StringMid c0, A_PriorHotKey,2, 1
   StringMid c1, A_ThisHotKey, 3, 1
   If (c0 = "+" and A_TimeSincePriorHotkey < 700)
      Send {BS}%c1%
Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 7:44 pm 
Help! wrote:
Actually, I got the speech to speed up... The response is still pretty sluggish, though...

Code:
; Speak letters
keysSpeak = QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm="<>.,()!?
Loop Parse, keysSpeak
{
   HotKey ~%A_LoopField%, Speak
}
Speak:
TEMPFILE = %TEMP%\TALK.vbs
IfExist, %TEMPFILE%
  FileDelete, %TEMPFILE%
FileAppend, Dim Talk`nSet Talk =WScript.CreateObject("SAPI.SpVoice")`nTalk.Rate=10`nTalk.Speak "%A_ThisHotKey%",%TEMPFILE%
RunWait, %TEMPFILE%
FileDelete, %TEMPFILE%
Return

; Fix two CApital letters at the beginning of a word.
keys = -qwertyuiop[]\asdfghjkl'zxcvbnm=
Loop Parse, keys
   HotKey ~+%A_LoopField%, Hoty
Hoty:
   StringMid c0, A_PriorHotKey,2, 1
   StringMid c1, A_ThisHotKey, 3, 1
   If (c0 = "+" and A_TimeSincePriorHotkey < 700)
      Send {BS}%c1%
Return


This produces total silence for me - under WinXP.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2007, 8:37 pm 
Tim Tyler wrote:
This produces total silence for me - under WinXP.


I'm running XP with Service Pack 2 and the MS speech stuff is installed. If you go to the Control Panel, there should be a Speech icon. Upon clicking the icon, there should be a Text to Speech tab, where you can select the default voice that this code works with.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 6:25 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Why don't you create a separate vbs file for each key and run them when that key is pressed? It should give you a little more speed, but probably not much.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 11:39 am 
Help! wrote:
Tim Tyler wrote:
This produces total silence for me - under WinXP.


I'm running XP with Service Pack 2 and the MS speech stuff is installed. If you go to the Control Panel, there should be a Speech icon. Upon clicking the icon, there should be a Text to Speech tab, where you can select the default voice that this code works with.


The computer will happily say to me me:

You have selected Microsoft Sam as the computer's default voice.

...when I go there.

However, it is quite possible I'm missing some required software or
other.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 11:42 am 
Laszlo wrote:
Why don't you create a separate vbs file for each key and run them when that key is pressed? It should give you a little more speed, but probably not much.


I was thinking of using .WAV files.

I was hoping another AHK user had already done a much better
implementation than I'm likely to come up with.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 11:47 am 
Why not use XPs build in Narrator?
Start/Programs/Accessories/Accesability/Narrator/Read Typed Characters


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2007, 12:13 pm 
BoBo wrote:
Why not use XPs build in Narrator?
Start/Programs/Accessories/Accesability/Narrator/Read Typed Characters


On my system, that announces windows events, and reads text files you load, even if you only have the 'read characters' option on.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, HotkeyStick and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group