Jump to content
Sign in to follow this  
Noviceatthis

HotKeySet

Recommended Posts

Noviceatthis

Hello all

I recently wrote this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{ENTER}", "press")
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Computer Speak", 615, 176)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("Computer Speak", 8, 8, 591, 33, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN))
GUICtrlSetFont(-1, 18, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xA6CAF0)
$Label2 = GUICtrlCreateLabel("Type Anything into the Box Below and hear the Computer Say It", 8, 56, 596, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN))
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xA6CAF0)
$Input1 = GUICtrlCreateInput("", 8, 96, 593, 24)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Speak", 32, 128, 553, 41)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
$text = GUICtrlRead($Input1)
$voice = ObjCreate("SAPI.SpVoice")
$voice.speak($text)
GUICtrlSetData($Input1, "")
ControlClick("", "", "[CLASS:Edit; INSTANCE:1]")

EndSwitch
WEnd

Func press()
ControlClick("", "", "[CLASS:Button; INSTANCE:1]")
EndFunc

and it works, but one issue I have with it is that if the window is running whilst im doing something else, i.e. writing in word, because of the HotKeySet, it will not let me press Enter, is there any way to set it so that the HotKeySet only runs when the window is highlighted??

thanks

Edited by Noviceatthis

Share this post


Link to post
Share on other sites
FireFox

Hi,

Maybe

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Noviceatthis

thanks FireFox, got it working :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×