NoBreak2004 AppleScript's Masters
Nombre de messages : 4 Age : 33 Vos connaissances en applescript : Les bases de chez bases Date d'inscription : 01/11/2007
| Sujet: Automatisation de l'exportation de calendrier. Jeu 1 Nov - 0:20 | |
| Bon alors voila, J'ai adapté un script de JackJr300 sur le forum de macbidouille et voici ce que ça donne : - Code:
-
tell application "iCal" to activate tell application "System Events" to tell process "iCal" delay 1 keystroke "Travail" delay 1 tell menu item "Exporter…" of menu "Fichier" of menu bar 1 to click delay 1 keystroke (ASCII character 13) delay 1 if exists button "Remplacer" of sheet 1 of sheet 1 of window 1 then click button "Remplacer" of sheet 1 of sheet 1 of window 1 delay 1 repeat until (not (exists sheet 1 of window 1)) delay 1 end repeat end tell Ce script fonctionne pour l'exportation automatique, le problème c'est que je n'arrive pas à sélectionner le bon calendrier au début. En effet, si la liste des différents calendriers n'est pas sélectionnée, iCal exporte le mauvais calendrier ( celui sélectionner précédemment ). Comment palier ce système et comment aussi sélectionner le dossier d'exportation ? | |
|
NoBreak2004 AppleScript's Masters
Nombre de messages : 4 Age : 33 Vos connaissances en applescript : Les bases de chez bases Date d'inscription : 01/11/2007
| Sujet: Re: Automatisation de l'exportation de calendrier. Sam 10 Nov - 20:19 | |
| Non bon voila c'est résolu, grace a JackJr300 Voila le script ( avec une exportation transmit ) : - Code:
-
set liste_fichiers to {} tell application "iCal" activate set nbr to number of calendars end tell
repeat with i from 1 to nbr try tell application "iCal" to tell calendar i show event 1 -- selectionne le calendrier set t_name to name end tell exporter_cal(t_name) end try end repeat
tell application "System Events" to tell process "iCal" tell button 1 of tool bar 1 of window "iCal" of application process "iCal" of application "System Events" to click end tell
tell application "System Events" set these_files to every file of folder ":Users:andre:Documents:Calendriers iCal:" end tell set theServerAddress to "serveur" set theUserName to "nom" set thePassword to "password" set theDirectory to "chemin" tell application "Transmit" set theDocument to make new document with properties {name:theServerAddress} tell theDocument tell current session connect to theServerAddress as user theUserName with password thePassword with initial path theDirectory repeat with i from 1 to the count of these_files set this_file to (item i of these_files as alias) set this_info to info for this_file if visible of this_info is true and alias of this_info is false then upload item this_file with resume mode replace tell application "Finder" to delete this_file end if end repeat disconnect end tell close theDocument end tell end tell
on exporter_cal(nom) tell application "iCal" to activate tell application "System Events" to tell process "iCal" tell menu item "Exporter…" of menu "Fichier" of menu bar 1 to click delay 1 keystroke (ASCII character 13) delay 1 repeat until (not (exists sheet 1 of window 1)) delay 1 end repeat end tell end exporter_cal | |
|