I want to import the value of a python variable into applescript using the py-applescript module.
In particular I have a python variable speech = "Good Morning" that I want to use in applescript with the say speech command.
I know how to do this with :
import subprocess
speech = "Good Morning"
subprocess.call('say %s -v Alex -r 180' %(speech), shell=True)
What do I have to do to accomplish something like this?
import applescript
speech = "Good Morning"
my_apple_script = '''
say speech using Alex
'''
cmd = applescript.AppleScript(source=my_apple_script)
reply = cmd.run()