Sign in to follow this  
Followers 0
JohnWang

Global Constant

5 posts in this topic

I have declared $phrase to be a global variable, however, everything I ran the screen the compiler say the variable is not declared. Thanks for the help in advance.

AutoItSetOption("MustDeclareVars",1)

TextSpeech("This was a triumph.")
TextSpeech("I'm making a note here:")
TextSpeech("HUGE SUCCESS.")
TextSpeech("It's hard to overstate")
TextSpeech("my satisfaction.")
TextSpeech("Aperture Science")
TextSpeech("We do what we must")
TextSpeech("because we can.")
TextSpeech("For the good of all of us.")
TextSpeech("Except the ones who are dead.")
TextSpeech("But there's no sense crying")
Global $phrase

Func TextSpeech($msg)
    Dim $PID,$Handle
    If Not ProcessExists("rundll32.exe") Then
        Run("control speech")
        WinWait("Speech Properties","You can control the voice properties, speed, and other options for text-to-speech translation")
        $PID = WinGetProcess("Speech Properties","You can control the voice properties, speed, and other options for text-to-speech translation")
        $Handle = WinGetHandle("Speech Properties","You can control the voice properties, speed, and other options for text-to-speech translation")
        $phrase = $Handle
    EndIf
        ControlSetText($phrase,"",1017,$msg)
        WinSetState("Speech Properties","You can control the voice properties, speed, and other options for text-to-speech translation",@SW_Hide)
        Sleep(100)
        ControlClick("Speech Properties","",1019)
        Sleep(1000)
    ;MsgBox(0,"STOP",ControlgetText($Handle,"",1019))
;   While ControlgetText($Handle,"",1019) = "S&top"
;       Sleep(500)
;   Wend
    ;$ret = ProcessClose("rundll32.exe")
EndFunc


            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                        





(adsbygoogle = window.adsbygoogle || []).push({});




                    
                
                    
                    
                    






    
    
        
Valuater   

    
        
    
             106
    
        
    

        
            
                Universalist
            
            

            
                

    
        
    

            
            MVPs
            
                
            
            
                

    
        
    
             106
    
        
    

                11,102 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #2 · 
            Posted 
            
            
            
        
    

    


            
        
            Might want to look at this

TextSpeech("This was a triumph.")
TextSpeech("I'm making a note here:")
TextSpeech("HUGE SUCCESS.")
TextSpeech("It's hard to overstate")
TextSpeech("my satisfaction.")
TextSpeech("Aperture Science")
TextSpeech("We do what we must")
TextSpeech("because we can.")
TextSpeech("For the good of all of us.")
TextSpeech("Except the ones who are dead.")
TextSpeech("But there's no sense crying")
Global $phrase

; voice read text
; Author erifash ( and others )


Func TextSpeech($s_text)
    Local $o_speech
    $o_speech = ObjCreate("SAPI.SpVoice")
    If IsObj($o_speech) Then $o_speech.Speak ($s_text)
    $o_speech = ""
EndFunc ;==>_TalkOBJ

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Might want to look at this

TextSpeech("This was a triumph.")
TextSpeech("I'm making a note here:")
TextSpeech("HUGE SUCCESS.")
TextSpeech("It's hard to overstate")
TextSpeech("my satisfaction.")
TextSpeech("Aperture Science")
TextSpeech("We do what we must")
TextSpeech("because we can.")
TextSpeech("For the good of all of us.")
TextSpeech("Except the ones who are dead.")
TextSpeech("But there's no sense crying")
Global $phrase

; voice read text
; Author erifash ( and others )


Func TextSpeech($s_text)
    Local $o_speech
    $o_speech = ObjCreate("SAPI.SpVoice")
    If IsObj($o_speech) Then $o_speech.Speak ($s_text)
    $o_speech = ""
EndFunc ;==>_TalkOBJ

8)

WOOOOOOOOOOOOOOW, I bow to your skills!

lol, anyways...

Thanks! That really helps!

Share this post


Link to post
Share on other sites

Welcome!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I have declared $phrase to be a global variable, however, everything I ran the screen the compiler say the variable is not declared. Thanks for the help in advance.

The variable $phrase is declared after you have called the function which uses it. If you had declared it at the start it would have been ok.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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