dimez2018 Posted April 11, 2018 Share Posted April 11, 2018 Hello i am new here,i need lite help with script, it is about input functions,i need to connect my input to button that will do some action,if somebody here please answer,i will show my script and details,thank you. Link to comment Share on other sites More sharing options...
dimez2018 Posted April 11, 2018 Author Share Posted April 11, 2018 Here is my script.When you press button,robot says Hi Autoit forum,are you okay? As you can see on the bottom of script. But i need to connect it to input and button,so if you type some text and press button,robot says your text.Pleae any one help if you know how to do it. Link to comment Share on other sites More sharing options...
dimez2018 Posted April 11, 2018 Author Share Posted April 11, 2018 #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <IE.au3> Example() Func Example() Local $msg GUICreate("Mix from Deeman", 500,500) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) GUISetBkColor(0X000000) Global $hGuiWin = GUICreate ( "Mix from Deeman 2", 350, 200) GUISetBkColor (0x000000, $hGuiWin ) GUICtrlCreatePic('1491301715_promoutery_xaxa-net.ru-5.jpg', 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Button_1 = GUICtrlCreateInput("Sample Input Box", 35, 55, 130, 20) $Button_1 = GUICtrlCreateButton("downloads", 10, 30, 70) GUISetState() ; will display an dialog box While 1 Local $hWnd, $hMain $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Local Const $CLSID_SpVoice= "{96749377-3391-11D2-9EE3-00C04F797396}" Local Const $IID_ISpVoice="{6C44DF74-72B9-4992-A1EC-EF996E0422D4}" Local Const $SPF_DEFAULT = 0 Local Const $sSpVoice = "SetNotifySink hresult(ptr)" & _ "SetNotifyWindowMessage hresult(hwnd;uint;long;long);" & _ "SetNotifyCallbackFunction hresult(ptr;long,long);" & _ "SetNotifyCallbackInterface hresult(ptr;long,long);" & _ "SetNotifyWin32Event hresult();" & _ "WaitForNotifyEvent hresult(dword);" & _ "GetNotifyEventHandle hresult();" & _ "SetInterest hresult(long;long);" & _ "GetEvents hresult(ulong;ptr;ptr)" & _ "GetInfo hresult(ptr);" & _ "SetOutput hresult(ptr;boolean);" & _ "GetOutputObjectToken hresult(ptr);" & _ "GetOutputStream result(ptr);" & _ "Pause hresult();" & _ "Resume hresult();" & _ "SetVoice hresult(ptr);" & _ "GetVoice hresult(ptr);" & _ "Speak hresult(wstr;dword;ulong);" & _ "SpeakStream hresult(ptr;dword;ulong);" & _ "GetStatus hresult(ptr;ptr);" & _ "Skip hresult(wstr;long;ulong);" & _ "SetPriority hresult(long);" & _ "GetPriority hresult(ptr);" & _ "SetAlertBoundary hresult(long);" & _ "GetAlertBoundary hresult(ptr);" & _ "SetRate hresult(long);" & _ "GetRate hresult(ptr);" & _ "SetVolume hresult(ushort);" & _ "GetVolume hresult(ptr);" & _ "WaitUntilDone hresult(ulong);" & _ "SetSyncSpeakTimeout hresult(ulong);" & _ "GetSyncSpeakTimeout hresult(ptr);" & _ "SpeakCompleteEvent hresult();" & _ "IsUISupported hresult(ptr;ptr;ptr;ptr);" & _ "DisplayUI hresult(hwnd;ptr;ptr;ptr;ulong);" Local $oSpVoice = ObjCreateInterface($CLSID_SpVoice, $IID_ISpVoice, $sSpVoice) $oSpVoice.SetRate(-3) $oSpVoice.speak("?Hi Autoit Forum, Are you Okay?",$SPF_DEFAULT,0) Exit EndSelect Wend EndFunc Link to comment Share on other sites More sharing options...
dimez2018 Posted April 12, 2018 Author Share Posted April 12, 2018 Just now, dimez2018 said: Link to comment Share on other sites More sharing options...
KickStarter15 Posted April 12, 2018 Share Posted April 12, 2018 (edited) Try: $oSpVoice.speak($Button_1,$SPF_DEFAULT,0) P.S. Don't use two the same name for two different functions. $Button_1 is for InputBox() and there is another $Button_1 for GUICtrlCreateButton(). Replace $Button_1 = GUICtrlCreateButton("downloads", 10, 30, 70) with $Button = GUICtrlCreateButton("downloads", 10, 30, 70). Edited April 12, 2018 by KickStarter15 Edited Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 12, 2018 Moderators Share Posted April 12, 2018 @dimez2018 In the future please give your threads a descriptive title. This is a help forum - titling a thread "I need help" really doesn't inspire our forum volunteers to want to assist. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
dimez2018 Posted April 12, 2018 Author Share Posted April 12, 2018 JLogan3o13 i m sory about my title it is litle complicated to say what i need in short title,and thanks to KickStarter15 i did change $Button_1 = GUICtrlCreateButton("downloads", 10, 30, 70) for $Button = GUICtrlCreateButton("downloads", 10, 30, 70) but it is not working?maybe i did mistake somewere else? Link to comment Share on other sites More sharing options...
dimez2018 Posted April 12, 2018 Author Share Posted April 12, 2018 i did exactly as you say and whatever i type,robot just says "three" Link to comment Share on other sites More sharing options...
Zedna Posted April 12, 2018 Share Posted April 12, 2018 Maybe something like this expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <IE.au3> Example() Func Example() Local Const $CLSID_SpVoice = "{96749377-3391-11D2-9EE3-00C04F797396}" Local Const $IID_ISpVoice = "{6C44DF74-72B9-4992-A1EC-EF996E0422D4}" Local Const $SPF_DEFAULT = 0 Local Const $sSpVoice = "SetNotifySink hresult(ptr)" & _ "SetNotifyWindowMessage hresult(hwnd;uint;long;long);" & _ "SetNotifyCallbackFunction hresult(ptr;long,long);" & _ "SetNotifyCallbackInterface hresult(ptr;long,long);" & _ "SetNotifyWin32Event hresult();" & _ "WaitForNotifyEvent hresult(dword);" & _ "GetNotifyEventHandle hresult();" & _ "SetInterest hresult(long;long);" & _ "GetEvents hresult(ulong;ptr;ptr)" & _ "GetInfo hresult(ptr);" & _ "SetOutput hresult(ptr;boolean);" & _ "GetOutputObjectToken hresult(ptr);" & _ "GetOutputStream result(ptr);" & _ "Pause hresult();" & _ "Resume hresult();" & _ "SetVoice hresult(ptr);" & _ "GetVoice hresult(ptr);" & _ "Speak hresult(wstr;dword;ulong);" & _ "SpeakStream hresult(ptr;dword;ulong);" & _ "GetStatus hresult(ptr;ptr);" & _ "Skip hresult(wstr;long;ulong);" & _ "SetPriority hresult(long);" & _ "GetPriority hresult(ptr);" & _ "SetAlertBoundary hresult(long);" & _ "GetAlertBoundary hresult(ptr);" & _ "SetRate hresult(long);" & _ "GetRate hresult(ptr);" & _ "SetVolume hresult(ushort);" & _ "GetVolume hresult(ptr);" & _ "WaitUntilDone hresult(ulong);" & _ "SetSyncSpeakTimeout hresult(ulong);" & _ "GetSyncSpeakTimeout hresult(ptr);" & _ "SpeakCompleteEvent hresult();" & _ "IsUISupported hresult(ptr;ptr;ptr;ptr);" & _ "DisplayUI hresult(hwnd;ptr;ptr;ptr;ulong);" GUICreate("Mix from Deeman", 500, 500) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) GUISetBkColor(0X000000) Global $hGuiWin = GUICreate("Mix from Deeman 2", 350, 200) GUISetBkColor(0x000000, $hGuiWin) GUICtrlCreatePic('1491301715_promoutery_xaxa-net.ru-5.jpg', 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Input_1 = GUICtrlCreateInput("Sample Input Box", 35, 55, 130, 20) $Button_1 = GUICtrlCreateButton("downloads", 10, 30, 70) GUISetState() ; will display an dialog box While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 $oSpVoice = ObjCreateInterface($CLSID_SpVoice, $IID_ISpVoice, $sSpVoice) $oSpVoice.SetRate(-3) $text = GUICtrlRead($Input_1) $oSpVoice.speak($text, $SPF_DEFAULT, 0) Exit EndSelect WEnd EndFunc ;==>Example Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dimez2018 Posted April 12, 2018 Author Share Posted April 12, 2018 Zenda wow it is working Thank you so mutch,i like you guys.I will see details on your code what made it ti run,now i can have fun! Link to comment Share on other sites More sharing options...
dimez2018 Posted April 12, 2018 Author Share Posted April 12, 2018 1 hour ago, dimez2018 said: Yes i see,i did it up side down,i think i should say SOLVED !! Link to comment Share on other sites More sharing options...
KickStarter15 Posted April 13, 2018 Share Posted April 13, 2018 4 hours ago, dimez2018 said: change $Button_1 = GUICtrlCreateButton("downloads", 10, 30, 70) for $Button = GUICtrlCreateButton("downloads", 10, 30, 70) but it is not working?maybe i did mistake somewere else? Yup definitely there is when creating that code, your inquiry for input box can also be found in our help file where you can check how to use GUICtrlCreateInput(), InputBox()... etc. functions. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. 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