Déménagement
Quelqu'un connaît un petit déménageur pas cher sur la région parisienne et disponible rapidement ?(Tout venant, 2005/02/13 08:31) lien permanent
dimanche 13 février 2005Quelqu'un connaît un petit déménageur pas cher sur la région parisienne et disponible rapidement ?(Tout venant, 2005/02/13 08:31) lien permanent
jeudi 10 février 2005Pierre nous annonce la fermeture de la rondelle, dans 45 jours nous pourrons dire paix à son blog. Courrez participer au concours d'épitaphe.(Tout venant, 2005/02/10 05:53) lien permanent
lundi 7 février 2005Après le switch, il est tout naturel de commencer a appréhender la bête par les scripts. Le premier candidat est tout trouvé : un script fourni pour créer un dossier et une règle dans Mail pour une mailing-list. Malheureusement les ML que je reçois ne contiennent ni l'en-tête Sender, ni List-Id. Donc petite modification du script pour utiliser List-Post à la place. Ceci donne le script suivant :
(*
Damien Bonvillain 2004/05
Create a new rule based on the List-Post header of an email received from a mailing-list.
In theory, should work, but in practice fails miserabily. From my experiments, it seems that
making a new rule condition with "header key" is buggy, as the rule condition ends up being for
the sender of the mail.
So, after the folder and the rule are created, one must edit the rule condition, change the "sender is" to "List-Post" header (by creating it if needed).
Created from Create New Mailing List Mailbox
Copyright © 2003 Apple Computer, Inc.
*)
using terms from application "Mail"
on perform mail action with messages msgs
tell application "Mail"
set listIds to {}
set senderHeaders to {}
repeat with msg in msgs
set headerKey to "List-Post"
set listId to (my get_header_from_message(headerKey, msg))
if listId is not "" then
set listName to content of item 1 of listId
set i to my index_of(listName, ":")
set listName to text from character (i + 1) to character (length of listName) of listName
set i to my index_of(listName, "@")
set listName to text from character 1 to character (i - 1) of listName
try
set mboxName to "Mailing Lists/" & listName
try
set res to display dialog "Enter the mailbox name:" default answer (mboxName as string)
set mboxName to text returned of res
on error
return
end try
set mbox to mailbox named mboxName
get name of mbox
on error
if mboxName is not "" then
make new mailbox with properties {name:mboxName}
set mbox to mailbox named mboxName
end if
end try
-- Now set up the rule for the mailbox
set listIdHeader to content of item 1 of listId
set newRule to make new rule at end of rules with properties {name:"Mailing List - " & listName}
set should move message of newRule to yes
set move message of newRule to mbox
delete rule conditions of newRule
set myRuleCondition to make new rule condition at beginning of (rule conditions of newRule) with properties {rule type:header key, header:headerKey, expression:listIdHeader, qualifier:equal to value}
set enabled of newRule to true
log headerKey
display dialog "A new rule for this mailing list has been created."
else
display dialog "The selected email address does not appear to be from a mailing list. There is no List-Post header."
end if
end repeat
end tell
end perform mail action with messages
on get_header_from_message(desiredHeader, theMessage)
tell application "Mail"
set hdrs to (headers of theMessage)
repeat with hdr in hdrs
if name of hdr is desiredHeader then
return contents of hdr
end if
end repeat
return ""
end tell
end get_header_from_message
(*
on run
tell application "Mail"
set selMsgs to selection
end tell
tell me to perform mail action with messages selMsgs
tell application "Mail"
properties of item 1 of rule conditions of the last item of rules
end tell
end run
*)
end using terms from
on index_of(haystack, needle)
repeat with i from 1 to count of characters in haystack
if character i of haystack is needle then
return i
end if
end repeat
return 0
end index_of
Bug ou erreur de codage ? Toujours est-il que même en rajoutant List-Post dans la liste des en-têtes valables pour les règles, le make new rule condition échoue silencieusement et crée une règle bâtarde. En plus je n'ai pas trop confiance en moi avec ce langage si éloigné de la syntaxe C, je ne me repère pas dans cette absence de ponctuation ; où mettre les conjonctions, n'en manque-t'il pas une ? Pourquoi est-ce que Mail faillit silencieusement dans quasiment tous les cas d'erreur que j'ai introduit ? Pas très rassurant tout ça.
Mise à jour 2005/02/07. Benjamin propose la modification suivante :
set theCond to make new rule condition tell theCond (* set rule type to «constant erutthdk» set «property rhed» to listHeader *) set rule type to «constant erutthdk» set «property rhed» to headerKey set qualifier to equal to value set expression to listIdHeader end tellA tester. Dommage que je me sépare de mon Mac dans peu de temps.(Tout venant, 2005/02/07 04:41) lien permanent
I have solved the problem!
In "...properties { header:headerKey ... }" the header property is being interpreted by the AppleScript compiler as «property mhdr» but in this context it should be «property rhed» instead. My solution is to create the rule condition this way:
set theCond to make new rule condition
tell theCond
(*
set rule type to «constant erutthdk»
set «property rhed» to listHeader
*)
set rule type to «constant erutthdk»
set «property rhed» to headerKey
set qualifier to equal to value
set expression to listIdHeader
end tell
I repeated those two lines as the comments because, once compiled, they will be transformed into their text form. You will need to copy and paste them again each time you recompile the script.
Posté par Benjamin Ragheb, le dimanche 6 février 2005 à 19:14 #
Emmaüs?
Posté par coach, le dimanche 13 février 2005 à 09:25 #
On tient à récupérer nos affaires à peu près intactes au retour
Posté par Damien B, le dimanche 13 février 2005 à 10:26 #
Compté pas sur moi, j'ai deja donné !
Posté par Fabien, le dimanche 13 février 2005 à 13:02 #
Dommage, vous avez un grand coffre
Posté par Damien B, le lundi 14 février 2005 à 03:40 #
Il leur est arrivé quoi à tes pakistanais ??
Posté par Florent, le lundi 14 février 2005 à 03:54 #
Ils ont choisis d'être en vacance pil-poil dans cette quinzaine-là exprès pour nous embêter.
Posté par Damien B, le lundi 14 février 2005 à 03:57 #
Bah vous avez une voitu !
Posté par Zapping, le lundi 14 février 2005 à 13:01 #
c kan le grand départ?
Posté par christophe, le lundi 14 février 2005 à 17:34 #
Le 23 avec Air Chiiiiiiina. C'est toujours mieux qu'Aeroflot
Posté par Damien B, le lundi 14 février 2005 à 17:38 #
Je rappelle aux âmes bienveillantes que le déménagement est samedi.
Posté par Damien B, le mercredi 16 février 2005 à 07:20 #
Une des âmes bienveillantes demande les horaires. Ce n'est pas qu'elle a un emploi du temps surchargé mais presque...
Posté par Zapping, le mercredi 16 février 2005 à 15:21 #
On va dire vers 9h/9h30 samedi matin.
Posté par Damien B, le mercredi 16 février 2005 à 17:23 #
Le Nano LG me paraît l'arme idéale dans cet environnement mais attention aux suiCIdes !
Posté par zapping, le jeudi 17 février 2005 à 03:59 #
Mais attention à ne pas faire le boucher...
Posté par Damien B, le jeudi 17 février 2005 à 05:21 #
ou alors kasher...
Posté par Bouilloire, le jeudi 17 février 2005 à 11:11 #