Thanks, it worked like a charm. I also edited my Group iMessage Script
Single Buddy iMessage- Code: Select all
import applescript
pyBuddy = indigo.variables["iMessage_Buddy1"].value
pyMessage = indigo.variables["iMessage_Message"].value
# First half of the AppleScript to handle the python variable value substitutions (could also define an AppleScript func and pass arguments)
script_source = '''
tell application "Messages"
set asBuddy to "{}"
set asMessage to "{}"
'''.format(pyBuddy, pyMessage)
# Second half of the script to construct and send the chat message
script_source += '''
set newChat to make new text chat with properties {participants:{buddy asBuddy}}
send asMessage to newChat
end tell'''
# Create and execute the AppleScript:
script = applescript.AppleScript(source=script_source)
script.run()
Two Buddy iMessage- Code: Select all
import applescript
pyBuddy1 = indigo.variables["iMessage_Buddy1"].value
pyBuddy2 = indigo.variables["iMessage_Buddy2"].value
pyMessage = indigo.variables["iMessage_Message"].value
# First half of the AppleScript to handle the python variable value substitutions (could also define an AppleScript func and pass arguments)
script_source = '''
tell application "Messages"
set asBuddy1 to "{}"
set asBuddy2 to "{}"
set asMessage to "{}"
'''.format(pyBuddy1, pyBuddy2, pyMessage)
# Second half of the script to construct and send the chat message
script_source += '''
set newChat to make new text chat with properties {participants:{buddy asBuddy1, buddy asBuddy2}}
send asMessage to newChat
end tell'''
# Create and execute the AppleScript:
script = applescript.AppleScript(source=script_source)
script.run()
If you have any ideas on how I can dynamically pass either one or more contacts to an Indigo Variable, and have this script read and detect how many buddy's needed to be added to the iMessage? No biggie if you don't. I have it all working now.
Thanks a bunch