Speak Command

  1. 3 months ago

    When using the Speak Command, is it possible to select a specific voice, or are you stuck with whatever is currently being used by the system?

    Thanks!

    @RobertCampanaro That's what I thought. Before I invest money into a plugin, do you know if you're able to sell apps on the App Store which use
    Applescript?

    Yes, you can use AppleScript in a Mac App Store app, but System Events and Desktop are off limit.

  2. Christian S

    Mar 13 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Yes, stuck.
    Or you use a plugin to change voice.

    see NSSpeechSynthesizerMBS and WinSpeechMBS classes in MBS Plugins .

  3. That's what I thought. Before I invest money into a plugin, do you know if you're able to sell apps on the App Store which use
    Applescript?

  4. Thomas E

    Mar 13 Pre-Release Testers
    Edited 3 months ago

    No Plugin needed (at least on Mac). You may either use declares or just AppleScript.

    From Proper way to execute an AppleScript? :

    Public Function ExecuteAppleScript(TheScript As String) as String
      Soft Declare Function NSClassFromString Lib "Foundation" (classname As CFStringRef) As ptr
      Soft Declare Function initWithSource Lib "Cocoa" selector "initWithSource:" (obj As ptr,source As CFStringRef) As ptr
      Soft Declare Function executeAndReturnError Lib "Cocoa" selector "executeAndReturnError:" (obj As ptr,ByRef error As ptr) As ptr
      Soft Declare Function alloc Lib "Cocoa" selector "alloc" (classRef As Ptr) As Ptr
      Soft Declare Function autorelease Lib "Cocoa" selector "autorelease" (classRef As Ptr) As Ptr
      Soft Declare Function stringValue Lib "Cocoa" selector "stringValue" (classRef As Ptr) As CFStringRef
      
      Dim nsscript As ptr=autorelease(initWithSource(alloc(NSClassFromString("NSAppleScript")),TheScript)))
      Dim err As ptr
      Dim descriptor As ptr=executeAndReturnError(nsscript,err)
      If descriptor = Nil Then
        MsgBox "An error occured"
      Else
        Return stringValue(descriptor)
      End If  
     
    End Function

    Now call it e.g. via

    Call ExecuteAppleScript("say ""This is a test"" Using ""Anna""")
    Call ExecuteAppleScript("say ""This is a test"" Using ""Markus""")
  5. Michel B

    Mar 13 Pre-Release Testers Answer RubberViews.com

    @RobertCampanaro That's what I thought. Before I invest money into a plugin, do you know if you're able to sell apps on the App Store which use
    Applescript?

    Yes, you can use AppleScript in a Mac App Store app, but System Events and Desktop are off limit.

  6. MacOSlib offers several speech-options besides selecting any voice of your choice.

    The 64bit version works too, although with this particular version (64bit) at present one cannot set the "speed-rate".

  7. Yes, you can use AppleScript in a Mac App Store app, but System Events and Desktop are off limit.

    Thanks, Michel. System Events were exactly what I wanted to use. I'll look into MacOSlib as Carlo suggested.

    Regards,
    -Rob

  8. MacOSlib offers several speech-options besides selecting any voice of your choice.

    The 64bit version works too, although with this particular version (64bit) at present one cannot set the "speed-rate".

    Thanks, Carlo. I'll take a look at that. Speed-rate shouldn't be an issue since I'm only interested in speaking one word at a time.

    Regards,
    -Rob

  9. Thanks again, Carlo. I tried to reply in private thread but it was saying I don't have permission; whatever that means. At any rate, I'm piecing together a test project now from the example. I'll give you an update but it's looking good so far.

    -Rob

  10. Glad if it helps.

or Sign Up to reply!