# Author : Magetys # Link : http://www.magetys.com # Version : 1.0 # Description : Récupérer et mettre en fond d'écran le Bonjour Madame du jour tell application "GrowlHelperApp" set the allNotificationsList to ¬ {"SuccesBM", "ErreurBM"} set the enabledNotificationsList to ¬ {"SuccesBM", "ErreurBM"} register as application ¬ "Bonjour Madame" all notifications allNotificationsList ¬ default notifications enabledNotificationsList ¬ icon of application "airport utility" end tell set connexion to false set cpt to 0 repeat while cpt < 3 and connexion is false try set commande to "curl --connect-timeout 5 http://www.bonjourmadame.fr | grep -Eo \"http://www.bonjourmadame.fr/photo/[^\\\"]+\"" set imagePath to do shell script commande set connexion to true on error try set commande to "curl --connect-timeout 5 http://www.bonjourmadame.fr | grep -Eo \"http://[0-9]+.media.tumblr.com/tumblr[^\\\"|']+\"" set imagePath to do shell script commande set connexion to true on error delay 60 end try end try set cpt to cpt + 1 end repeat if connexion is true then set destinationFile to ((path to desktop pictures folder as string) & "bonjourmadame.jpg") tell application "URL Access Scripting" download imagePath to destinationFile replacing yes end tell tell application "Finder" set picPath to path to desktop pictures folder set desktop picture to file "Panther Aqua Blue.jpg" of (picPath) set desktop picture to file "bonjourmadame.jpg" of (picPath) end tell tell application "GrowlHelperApp" notify with name ¬ "SuccesBM" title ¬ "Bonjour Madame" description ¬ "Une nouvelle BonjourMadame vous attend !" application name "Bonjour Madame" end tell else tell application "GrowlHelperApp" notify with name ¬ "ErreurBM" title ¬ "Bonjour Madame" description ¬ "La Madame ne veut pas de toi aujourd'hui !" application name "Bonjour Madame" end tell end if