Help

I need some help with my application on applescript studio.
Here’s My Code:

on clicked theObject

tell window "main"
	set theText to (the context of text field "EnterText" of window "main") as string
	set theVoice to (the title of popup button "VoicePicker" of window "main") as string
end tell
say theText using theVoice

end clicked

If you could help, it would be great!
Thanks,
Charlie

Model: iMac
AppleScript: 2.2.1
Browser: Safari 525.20.1
Operating System: Mac OS X (10.5)

Hi,

it would be helpful to have the error message, but I guess it’s at least “Can’t get reference” -1728.
There are some mistakes

¢ double referencing (both tell window “main” and of window “main”)
¢ the value of the text field is string value or content but not context
¢ the title of the popup button is the title of the current menu item of the popup button

on clicked theObject
    tell window "main"
        set theText to string value of text field "EnterText"
        set theVoice to title of current menu item of popup button "VoicePicker"
    end tell
    say theText using theVoice
end clicked

The as string coercions are useless. Both values (text field and popup button) are text

Thanks So Much Stephen

Now I’m Getting a message that says:

Can’t get «class texF» “EnterText” of window “main”. (-1728)

here’s the code again:

on clicked theObject
tell window “main”
set theText to string value of text field “EnterText”
set theVoice to title of current menu item of of popup button “VoicePicker”
end tell
say theText using theVoice
end clicked

Probably the text field is not named in Interface Builder