Jump to content

Global Constant


Recommended Posts

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


            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Valuater
            
            
                Posted 
                
            
        
    
    
        


Valuater
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                MVPs
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 11.1k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        7
                                
                                    
                                
                            
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            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

Link to comment
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!

Link to comment
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.
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...