Hi everybody.
I´m working on a script to get a message group automated.
It´s a simple script that creates a new entry in a Numbers sheet to record the participant, date and message sent.
Everything is ok but one Event handler is triggered twice: Active chat room message received.
These are two links that shows the same issue, and weren’t solved.
I have the same issue.
http://macscripter.net/viewtopic.php?id=44582
Is this a bug?
This is my script.
property chat_target : “iMessage;+;chat278029391754081049” --Prueba mensajes
property ruta_libro_numbers : “Macintosh HD:Users:algonra:Library:Mobile Documents:com~apple~Numbers:Documents:actividad-grupo-prueba-mensajes.numbers”
using terms from application “Messages”
on actualizar_numbers(grupo_mensajes, remitente, mensaje)
if grupo_mensajes is chat id chat_target then
set nombre_cuenta_remitente to my obtener_nombre_online_cuenta_remitente(remitente)
set fecha_corta_actual to my obtener_fecha_actual_formato_corto()
my anadir_nuevo_registro(nombre_cuenta_remitente, fecha_corta_actual, mensaje)
else
display notification "Error: " & class of grupo_mensajes
end if
end actualizar_numbers
on obtener_fecha_actual_formato_corto()
set fecha_actual to current date
return short date string of fecha_actual
end obtener_fecha_actual_formato_corto
on obtener_nombre_online_cuenta_remitente(remitente)
return get handle of remitente
end obtener_nombre_online_cuenta_remitente
on anadir_nuevo_registro(cuenta_online, fecha, mensaje_remitente)
tell application "Numbers"
launch
delay 1
set libro to open ruta_libro_numbers
tell libro
tell first sheet
tell first table
if value of cell "A2" is missing value then
set value of cell "A2" to cuenta_online
set value of cell "B2" to fecha
set value of cell "C2" to mensaje_remitente
else
set num_filas to count of rows
set nueva_fila to add row below row num_filas
set num_fila_a_rellenar to num_filas + 1
set value of cell ("A" & num_fila_a_rellenar) to cuenta_online
set value of cell ("B" & num_fila_a_rellenar) to fecha
set value of cell ("C" & num_fila_a_rellenar) to mensaje_remitente
end if
end tell
end tell
end tell
end tell
end anadir_nuevo_registro
on received text invitation theText from theBuddy for theChat with withParam
display notification "received text invitation"
end received text invitation
on received audio invitation theText from theBuddy for theChat with withParam
display notification "received audio invitation"
end received audio invitation
on received video invitation theText from theBuddy for theChat with withParam
display notification "received video invitation"
end received video invitation
on received file transfer invitation theFileTransfer with withParam
display notification "received file transfer invitation"
end received file transfer invitation
on buddy authorization requested theRequest with withParam
display notification "buddy authorization requested"
end buddy authorization requested
on message sent theMessage for theChat with withParam
display notification "message sent"
end message sent
on message received theMessage from theBuddy for theChat with withParam
display notification "message received"
end message received
on chat room message received theMessage from theBuddy for theChat with withParam
display notification "chat room message received"
my actualizar_numbers(theChat, theBuddy, theMessage)
end chat room message received
on active chat message received theMessage from theBuddy for theChat with withParam
display notification "active chat message received"
my actualizar_numbers(theChat, theBuddy, theMessage)
end active chat message received
on addressed chat room message received theMessage from theBuddy for theChat with withParam
display notification "addressed chat room message received"
end addressed chat room message received
on addressed message received theMessage from theBuddy for theChat with withParam
display notification "addressed message received"
end addressed message received
on av chat started with withParam
display notification "av chat started"
end av chat started
on av chat ended with withParam
display notification "av chat ended"
end av chat ended
on login finished for theService with withParam
display notification "login finished"
end login finished
on logout finished for theService with withParam
display notification "logout finished"
end logout finished
on buddy became available theBuddy with withParam
display notification "buddy became available"
end buddy became available
on buddy became unavailable theBuddy with withParam
display notification "buddy became unavailable"
end buddy became unavailable
on completed file transfer with withParam
display notification "completed file transfer"
end completed file transfer
end using terms from
Thanks very much in advanced