Jump to content

Need a litle help!


 Share

Recommended Posts

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

#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

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 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

  • Moderators

@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

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

Maybe something like this

#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

 

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...