New Version not tested !
Win Alt Z turns of voice recongintion (To Block out other noises)
Win Alt X ( Oppisite of Win Alt Z)
Dont Use The Mouse Use Your Voice!
this script lets you use your voice to left click or right click
without having to use the buttons which can cause strain on muscles causing you to have pain .
Once you hear started you may begin talking
Saying Left will produce a left click
saying right will produce a rightclick
2007-12-22 - Update .25
Everything the same except now you must use
CoHelper.ahk (Becasue of errors)
************************************
2007-12-07 - Update .20
Uses COM.ahk instead of CoHelper.ahk (Suggested By COM TTS & Sean)
Win Alt Z turns of voice recongintion (To Block out other noises)
Win Alt X ( Oppisite of Win Alt Z)
************************************
2007-12-07 - Update .15
Confirmed And Working
Faster Clicking as posted back by COM TTS
************************************
2007-12-07
Update .10 better word detection
although it is still not tested it should work
Need: CoHelper.ahk
Code:
http://www.autohotkey.net/~Sean/Scripts/CoHelper.zip
Code:
SetBatchLines -1
#NoEnv
#Include CoHelper.ahk
#Persistent
RegRead, Exist, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Speech, SDKPath
If Errorlevel = 1
gosub NotFoundD
Else
gosub Begin
return
Begin:
OnExit, CleanUp
CoInitialize()
pspeaker := ActiveXObject("SAPI.SpVoice")
plistener:= ActiveXObject("SAPI.SpSharedRecognizer")
pcontext := Invoke(plistener, "CreateRecoContext")
pgrammar := Invoke(pcontext, "CreateGrammar")
Invoke(pgrammar, "DictationSetState", 0)
prules := Invoke(pgrammar, "Rules")
prulec := Invoke(prules, "Add", "wordsRule", 0x1|0x20)
Invoke(prulec, "Clear")
pstate := Invoke(prulec, "InitialState")
; Add here the words to be recognized! Looks like it understands the null pointer.
Invoke(pstate, "AddWordTransition", "+" . 0, "Left")
Invoke(pstate, "AddWordTransition", "+" . 0, "Right")
;;
Invoke(prules, "Commit")
Invoke(pgrammar, "CmdSetRuleState", "wordsRule", 1)
Invoke(prules, "Commit")
ConnectObject(pcontext, "On")
If (pspeaker && plistener && pcontext && pgrammar && prules && prulec && pstate)
Invoke(pspeaker, "Speak", "Started")
Else Invoke(pspeaker, "Speak", "Starting Failed")
Return
CleanUp:
Release(pstate)
Release(prulec)
Release(prules)
Release(pgrammar)
Release(pcontext)
Release(plistener)
Release(pspeaker)
CoUninitialize()
ExitApp
OnRecognition(prms, this)
{
Global pspeaker
presult := DispGetParam(prms, 3, 9)
pphrase := Invoke(presult, "PhraseInfo")
text = % "" . Invoke(pphrase, "GetText")
if disabled = 1
return
Else If disabled = 0
If text = Left
gosub Lefty
Else If text = Right
gosub Righty
Release(pphrase)
}
NotFoundD:
url = http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/SpeechSDK51.exe
fileName = SpeechSDK51.exe
saveDir = %A_mydocuments%
Progress, X0 Y63 h75 w430,, Download Main Component. Be Patient , Download , bold
SetTimer, uProgress, 150
totalFileSize := HttpQueryInfo(url, 5)
UrlDownloadToFile, %url%, %fileName%
SetTimer, uProgress, off
Progress, Off
FileMove,%fileName%,%saveDir%
filegetSize,sizefil,%A_mydocuments%\%fileName%
if(sizefil = 1638)
goto,nofile
msgbox,Download finished
exitapp
nofile: ; When the file is not found, it creates a file of 1638 bytes
{
filedelete,%A_mydocuments%\%fileName%
msgbox,File not found on the site.
}
Exitapp
uProgress:
FileGetSize, fs, %fileName% ,K
a := Floor(fs/totalFileSize * 100*1024)
b := Floor(fs/totalFileSize * 10000*1024)/100
SetFormat, float, 0.2
b += 0
TFileSize := totalFileSize / 1024
Tfs=%TFileSize%
Progress,%a%,%b%`% downloaded: %fs% Kb. of %Tfs% Kb.
return
HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
If (Proxy != "")
AccessType=3
Else
AccessType=1
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)
Loop, 5
{
hqi := DllCall("wininet\HttpQueryInfoA"
, "uint", iou_hInternet
, "uint", QueryInfoFlag ;dwInfoLevel
, "uint", &buffer
, "uint", &buffer_len
, "uint", 0) ;lpdwIndex
If (hqi = 1) {
hqi=success
break
}
}
IfNotEqual, hqi, success, SetEnv, res, timeout
If (hqi = "success") {
p := &buffer
Loop
{
l := DllCall("lstrlen", "UInt", p)
VarSetCapacity(tmp_var, l+1, 0)
DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
p += l + 1
res := res . "`n" . tmp_var
If (*p = 0)
Break
}
StringTrimLeft, res, res, 1
}
DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
return, res
}
run, %Savedir%\%fileName%
msgbox, Extract the contents of this zip file to a folder then run Microsoft Speech SDK 5.1.msi
return
Lefty:
SendInput {LButton}
return
Righty:
SendInput {RButton}
return
#!z::
disabled = 1
return
#!x::
disabled = 0
return