Page 1 of 1

Converting ActionGroup to Python

PostPosted: Wed Oct 16, 2019 10:08 am
by Umtauscher
Hi,

I am not sure if I should post this in this plugin section or in the script section. Anyways:

I have a Notification category that has a minor problem after I converted my Applescripts to Python,
I use an action group that plays a sound via afplay before an announcement is spoken.
Code: Select all
import subprocess
subprocess.call("/usr/bin/afplay /Users/wilhelm/Music/STARWAVE/c827.WAV",shell=True)

This AG is set in the "before speech" option of the notification category. This AG used to play a common sound using the "do shell script" statement calling afplay in an embedded AppleScript.
So the sound was played before the announcement was spoken by the OS.
After convertion that mini scipt to python I realize, that the sound and the spoken text are produced simultaneously - I suppose the phython script runs in an additional thread so both are ececuted nearly at the same time.
What can I do?