Ho un flusso di lavoro di un automatore che funziona bene tranne che per una parte di esso - applescript.
Ecco come va il flusso di lavoro -
Esegui applescript (questa parte funziona bene) -
on run {input, parameters}
tell application "Mail" to set theMessageText to content of (get first message of inbox)
set x to text ((offset of "9" in theMessageText) + 2) thru ((offset of " " in theMessageText) - 1) of theMessageText
end run
Imposta il valore per la variabile (il nome della variabile è 'numero')
Ottieni valore per variabile (mi sono assicurato che questo non riceva input diretti da azioni precedenti. Sto chiamando la variabile 'numero' qui e ho duplicato questo processo altre 2 volte per chiamare altre 2 variabili)
Esegui Applescript (questo è il codice con cui ho un problema) -
on run {input, parameters}
set cat to first item of input
set x to second item of input
set o to third item of input
tell application "Contacts"
set thePerson to make new person with properties {first name:"Testing", last name:"Auto"}
make new phone at end of phones of thePerson with properties {label:"Main", value:x}
repeat with z from 1 to o
set a to item z of cat
add thePerson to group a
end repeat
save
end tell
end run
L'errore mostrato qui è "Errore di sintassi - Impossibile ottenere l'elemento 2. Indice non valido".
Il punto del flusso di lavoro è ottenere alcuni dettagli di contatto da una e-mail e aggiungerli come contatto nella rubrica (questo non è il flusso di lavoro completo in quanto è abbastanza grande. Ho mostrato solo le azioni pertinenti) .
Sarei grato per qualsiasi aiuto.