Noviceatthis Posted March 7, 2013 Share Posted March 7, 2013 (edited) Hello all I recently wrote this: expandcollapse popup#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 March 7, 2013 by Noviceatthis Link to comment Share on other sites More sharing options...
FireFox Posted March 7, 2013 Share Posted March 7, 2013 Hi,Maybe Br, FireFox. Link to comment Share on other sites More sharing options...
Noviceatthis Posted March 8, 2013 Author Share Posted March 8, 2013 thanks FireFox, got it working Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now