Apple et ses scripts...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.


Un forum dédié à AppleScript !
 
AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  Site officielSite officiel  
-50%
Le deal à ne pas rater :
-50% Baskets Nike Air Huarache Runner
69.99 € 139.99 €
Voir le deal

 

 Automatisation de l'exportation de calendrier.

Aller en bas 
AuteurMessage
NoBreak2004
AppleScript's Masters
AppleScript's Masters



Masculin Nombre de messages : 4
Age : 33
Vos connaissances en applescript : Les bases de chez bases
Date d'inscription : 01/11/2007

Automatisation de l'exportation de calendrier. Empty
MessageSujet: Automatisation de l'exportation de calendrier.   Automatisation de l'exportation de calendrier. EmptyJeu 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 ?
Revenir en haut Aller en bas
NoBreak2004
AppleScript's Masters
AppleScript's Masters



Masculin Nombre de messages : 4
Age : 33
Vos connaissances en applescript : Les bases de chez bases
Date d'inscription : 01/11/2007

Automatisation de l'exportation de calendrier. Empty
MessageSujet: Re: Automatisation de l'exportation de calendrier.   Automatisation de l'exportation de calendrier. EmptySam 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
Revenir en haut Aller en bas
 
Automatisation de l'exportation de calendrier.
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Apple et ses scripts... :: Set variable to choose from list :: Suggestion, bug, questions sur applescript!-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser