Ok, that's pretty easy then. Create an external Python script to be run instead of your external AppleScript:
- Code: Select all
import applescript
# Get the indigoPlaylist value
indigoPlaylist = indigo.variables[IDOF_indigoPlaylist].value
# Create your AppleScript and substitute in the indigoPlaylist value
script_source = '''
set IndigoPlaylist to "{}"
tell application "iTunes"
reveal playlist "Music"
reveal playlist IndigoPlaylist
end tell
# other stuff that your AppleScript does
tell application "iTunes" to play playlist IndigoPlaylist
'''.format(indigoPlaylist)
script_instance = applescript.AppleScript(source=script_source)
script_instance.run()
Then run it as an external Python script. The key here is to make sure that the AppleScript has the appropriate substitution markers in it so that you substitute the variable value into the right spot in the script. In this case, the line set IndigoPlaylist to "{}" is the critical line. When you call the .format() method on the script string, it will substitute the parameters for each occurrence of {}. In this case you only specify one substitution (the playlist name) and one parameter to the format() method.
Then, when the script is complete, we compile and run the AppleScript.
There are
other ways to do this as well but this one was the one I'd use.