Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Put a "Pronounced" sound as a file in a container - use "Say" command line with Perform AppleScript

Featured Replies

  • Newbies

Hi,

I try to put in a container an audio file with the text pronounced by FM from a text field.

As I didn't see how to do it from FM, I tried to build my first Perform AppleScript [] using the terminal command "Say"

On the terminal : (say "hello") works fine.

and (say "hello" -o filename.aiff) => creates a file with the sound "hello".

 

From filemaker, Perform AppleScript ["say \"hello\”"] : make the Mac pronounce correctly.

But I can't run :  Perform AppleScript ["say \"hello\” -o filename.aiff"]

I have a error message "Identificator can't be after identificator".

I couldn't find anyway out.

Does any of you have an idea ? 

I am afraid you are confusing AppleScript and Terminal. Both have a say command, but the behavior is different.

To make the AppleScript say command save the result to a file, use something like:

set myFile to (((path to desktop folder) as string) & "filename.aiff")
say "hello" saving to myFile

 

Alternatively, you can use AppleScript's do shell script command to execute Terminal commands from AppleScript. So something like:

do shell script "say -o filename.aiff hello"

 

 

  • Author
  • Newbies

Hi,

Thank you very much for explaining me that there are two "say" commands which I was confusing. It is much clearer to me now.

Still, I did not manage to save the file which any of the 2 options.

 

Option 1: I wrote Perform AppleScript[say "hello" saving to "/User/Antoine/hello.aiff"]. Nothing happened (Antoine is my User name)

Option 2: I wrote Perform AppleScript[do shell script "say \"hello\" -o filename.aiff"]. I have error message "Opening output file failed: -54"

Do you have any suggestions to help me solve this situation ?

Antoine

1 hour ago, AntoineD said:

Do you have any suggestions to help me solve this situation ?

I suggest you start by composing your AppleScript in the Script Editor application. Once you have it working there, ask how to implement it in Filemaker's Perform AppleScript[] script step - if you cannot work it out yourself). Until then, this is not a Filemaker-related question. I will give you this hint, though: "/User/Antoine/hello.aiff" is a string, not a file path. And you need to use AppleScript syntax for file paths - see: http://www.satimage.fr/software/en/smile/external_codes/file_paths.html

  • Author
  • Newbies

Hi, 

Great, it works !!!

Thank you so much for your help

 

For any futur reader in the forum, here is the final code: 

Perform AppleScript["set myFile to \"Macintosh HD:Users:Antoine:Desktop:" & Memrise::Russian & ".aiff\""&"¶say " & Citation(Memrise::Russian) & " using \"Yuri\" saving to myFile"]

Note 1: I had to use Yuri voice because the text to read is in Russian.

Note 2: The file is created on my desktop, which is fine for me.

Note 3: "Memrise" is the name of my FM file and table. "Russian" is the name of the field I wanted to "say" and save in audio file.

Antoine

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.