Bonjour les développeurs, voilà je vous expose mon souci. Ayant un peu de temps, j'ai décidé de "créer" (plutôt de plagier) quelques scripts. En l'occurrence, un script qui permettrai de créer un rendez-vous dans iCal à partir du Carnet d'adresse.
Je vous joint les lignes que j'ai plagiées et arrangées à ma convenance :
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for this_person with this_entry
set this_name to (first name of this_person) & " " & (last name of this_person)
return "Créer un événement 2avec " & this_name
end action title
on should enable action for this_person with this_entry
return true
end should enable action
on perform action for this_person with this_entry
set this_name to (first name of this_person) & " " & (last name of this_person)
set this_ID to the id of this_person
set these_labels to the label of phone of this_person
set these_numbers to the value of phone of this_person
set this_location to the *ici il y a un probleme* of this_person
set the phone_data to ""
repeat with i from 1 to the count of these_numbers
if the phone_data is "" then
set the phone_data to phone_data & item i of these_labels & space & item i of these_numbers
else
set the phone_data to phone_data & return & item i of these_labels & space & item i of these_numbers
end if
end repeat
my create_event(this_ID, this_name, this_location, phone_data)
end perform action
end using terms from
on create_event(this_ID, this_name, this_location, phone_data)
try
set this_URL to ("addressbook://" & this_ID)
tell application "iCal"
activate
set this_calendar to (the first calendar whose title is "Personnel")
tell this_calendar
set this_event to make new event at end of events with properties {summary: ("Rdv avec " & this_name), location:this_location, url:this_URL}
set description of this_event to the phone_data
show this_event
end tell
end tell
on error error_message
tell application "iCal"
activate
display dialog error_message buttons {"Cancel"} default button 1
end tell
end try
end create_event
J'ai mis en orange la partie qui me pose problème et en vert les zones qui peuvent aider à la lecture.
En remplaçant la zone orange par "first name", il n'y a pas de probleme, seulement je souhaiterai que dans la case "lieu" de l'événement iCal affiche non pas le prénom mais l'adresse du contact. J'ai par conséquent essayé de remplacer cette zone orange par "adresses", "city", "street" mais rien ne s'affiche alors.
Désolé si je ne suis pas très clair, n'hésitez pas à me demandez ce que vous ne comprenez pas, en revanche je ne connais pas encore le vocabulaire spécifique (ex : commande, variable...).
Merci d'avance !
Je vous joint les lignes que j'ai plagiées et arrangées à ma convenance :
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for this_person with this_entry
set this_name to (first name of this_person) & " " & (last name of this_person)
return "Créer un événement 2avec " & this_name
end action title
on should enable action for this_person with this_entry
return true
end should enable action
on perform action for this_person with this_entry
set this_name to (first name of this_person) & " " & (last name of this_person)
set this_ID to the id of this_person
set these_labels to the label of phone of this_person
set these_numbers to the value of phone of this_person
set this_location to the *ici il y a un probleme* of this_person
set the phone_data to ""
repeat with i from 1 to the count of these_numbers
if the phone_data is "" then
set the phone_data to phone_data & item i of these_labels & space & item i of these_numbers
else
set the phone_data to phone_data & return & item i of these_labels & space & item i of these_numbers
end if
end repeat
my create_event(this_ID, this_name, this_location, phone_data)
end perform action
end using terms from
on create_event(this_ID, this_name, this_location, phone_data)
try
set this_URL to ("addressbook://" & this_ID)
tell application "iCal"
activate
set this_calendar to (the first calendar whose title is "Personnel")
tell this_calendar
set this_event to make new event at end of events with properties {summary: ("Rdv avec " & this_name), location:this_location, url:this_URL}
set description of this_event to the phone_data
show this_event
end tell
end tell
on error error_message
tell application "iCal"
activate
display dialog error_message buttons {"Cancel"} default button 1
end tell
end try
end create_event
J'ai mis en orange la partie qui me pose problème et en vert les zones qui peuvent aider à la lecture.
En remplaçant la zone orange par "first name", il n'y a pas de probleme, seulement je souhaiterai que dans la case "lieu" de l'événement iCal affiche non pas le prénom mais l'adresse du contact. J'ai par conséquent essayé de remplacer cette zone orange par "adresses", "city", "street" mais rien ne s'affiche alors.
Désolé si je ne suis pas très clair, n'hésitez pas à me demandez ce que vous ne comprenez pas, en revanche je ne connais pas encore le vocabulaire spécifique (ex : commande, variable...).
Merci d'avance !