Jump to content

Perform an Applescript using FMPadvanced13


This topic is 2569 days old. Please don't post here. Open a new topic instead.

Recommended Posts

In my DB I have a text field I want to read 

The SPEAK script doesnt have enough options for my needs as it doesnt allow changes in pitch, rate, volume and modulation.

From witing FMP I can run the follwing Applescript

set TESTO to (choose file)

tell application "TextEdit"

set dialogo to text of (open TESTO)
say dialogo using "Daniel" speaking rate 100 pitch 60

end tell

The only part i need is 

say dialogo using "Daniel" speaking rate 100 pitch 60

where "dialogo" should be the text field to read with the choosen voice, rate, volume, modulation in my db

The original Applescriopt works perfectly from FMPad13. Use the British English voice DANIEL as the UK voices respond to all APPLE parameters speech better then others.

however I would need to create (and then select) several text files and consequently several FMP script to open and read them all

what is the proper syntax in the FMP advanced 13 to use the Applescript as a calculated script?

If this was possible and FMP would use the various parameters I need to use (RATE; Pitch, modulation ecc) in the APPLE voices I downloaded

I could simply write 4 scripts with the different parameters and avoid copying and searching for files away from the db

I sincerely thank anyone who would want to help

Dan

 

Edited by dkey
Link to comment
Share on other sites

On 4/27/2017 at 1:32 AM, comment said:

Couldn't this be much simpler?

 

AppleScriptSpeak.fmp12

thanks for your interest

your example is perfect but how to get to the external functions you suggest?

i'm working on a dialogue and each record should read various text with various voices

i hope to use a unique identifier which "calls" a certain voice with its own sound parameters to then swap to a different one meeting another unique identifier in the text file.

how else could i achieve this, but combining Applescript and external functions? is there a library i can find?

thanks from Taiwan

 

 

Link to comment
Share on other sites

31 minutes ago, dkey said:

how to get to the external functions you suggest?

I did not suggest using any external functions.

 

31 minutes ago, dkey said:

i hope to use a unique identifier which "calls" a certain voice with its own sound parameters to then swap to a different one meeting another unique identifier in the text file.

I guess you would want to split the text file into individual records, and store the voice parameters along with the text segment (using regular fields instead of the global fields used in my file). Then have your script construct a combined AppleScript consisting of one 'say' command for each record you want to include in the read out. Or just loop among the records and say each one in turn.

 

Edited by comment
Link to comment
Share on other sites

Thank you you are very kind: your suggestion works perfectly.  I have still a problem:

While looping, the script  will begin to read from the record I'm in, but although I end the script with

"Go to next record"

the script doesn't show me the next page. Although it does read the next record with the selected voice and parameters.

How can I solve this problem? I need to see the page and possibly to stop the script to edit the text. But I oly see one page and I am unable to stop the script pressing cmd+"."

I quoted "external functions" by mistake I then found the applescript going through the layout .... 

Just as a information;

Not every Apple voice reacts properly to the various parameters. I wonder if the Pitch and Modulation (set as text in your example) would work as numbers. In the Apple instructions on using the voices the appear as number, or it makes no difference? Voices do not react to the Modulation parameters ... 

Strangely the UK English, Australian English, Traditional Chinese and ..... Russian do but most others don't or some react to speed and nothing else.

( I did extensive tests on YOSEMITE after downloading many voices from Apple).

Is however quite fine as I'm using english in my text and if I need "weird speaking people" the russian and the chinese do more or less what I need simply adjusting a few lines so they will sound broken english rather than whatever else they do without changes.

 

Thanks again

Man Wan Dan

Edited by dkey
various errors
Link to comment
Share on other sites

3 hours ago, dkey said:

I need to see the page and possibly to stop the script to edit the text. But I oly see one page and I am unable to stop the script pressing cmd+"."

To have the window update when you go to the next record, use either the Refresh Window[] script step or pause the script for say 0.001 seconds.

Aborting is a little tricky, because pressing Command-. while an AppleScript is running aborts the AppleScript, not the Filemaker script. You must press Command-. again quickly enough to abort the Filemaker script before it calls another AppleScript. Hint: you can get rid of the AppleScript confirm dialogs by wrapping the say command in a try block. There may be a way to have the AppleScript cancel the Filemaker script too, but I don't have the time to experiment with that now.

 

3 hours ago, dkey said:

I wonder if the Pitch and Modulation (set as text in your example) would work as numbers.

Although the gPitch and gModulation fields In my example are Text fields (because I forgot to change their type to Number), their values are passed as numbers to the AppleScript. Changing the field type should make no practical difference.

Link to comment
Share on other sites

Thanks a lot you are very kind and I will try "your TRY suggestion" and let you know about the results.

I will now post another problem ... but it belongs to the importing exporting section but just in case you found it intersting I will add the link here

Thanks again

Link to comment
Share on other sites

This topic is 2569 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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