C y b e r M a c @ E x M a c h i n a ( M a i l i n g L i s t ) <http://www.cybercafe21.net> & <http://www.cybercafe21.tv>
Voici un petit scirpt trouv� sur internet bien rigolo.... Test� avec apple script 1.8 et mac os 10.1.2 ---------- (* Ce script permet d'imiter le "parler" des hackers pr�-pub�res. Il remplace al�atoirement chaque lettre du texte qui lui est donn� par une lettre ayant une graphie similaire. Le texte g�n�r� peut �tre du texte Mac ou du texte ISO 8859-1. En fait c'est toujours du texte Mac mais avec l'option ISO, seuls les caract�res Mac ayant une correspondance dans la table ISO 8859-1 sont utilis�s. Cette option permet d'utiliser le texte g�n�r� avec les outils qui transforment les caract�res MacOS en ISO 8859-1 (courrier �lectronique, lecteur de News...). Jo�l Brogniart <http://nte.univ-lyon2.fr/~brogniart> Test� avec MacOS 9 US et AppleScript 1.4 8/3/2000 1.0.1 - Ajout de l'option IS0 8859-1 5/3/2000 1.0 N'h�sitez pas � copier, coller, d�former... mais aussi � donner les sources de vos programmes � la communaut�. *) property standard_letters : {� {type:"vowel", symbols:"aA"}, � {type:"consonant", symbols:"bB"}, � {type:"consonant", symbols:"cC"}, � {type:"consonant", symbols:"dD"}, � {type:"vowel", symbols:"eE"}, � {type:"consonant", symbols:"fF"}, � {type:"consonant", symbols:"gG"}, � {type:"consonant", symbols:"hH"}, � {type:"vowel", symbols:"iI"}, � {type:"consonant", symbols:"jJ"}, � {type:"consonant", symbols:"kK"}, � {type:"consonant", symbols:"lL"}, � {type:"consonant", symbols:"mM"}, � {type:"consonant", symbols:"nN"}, � {type:"vowel", symbols:"oO"}, � {type:"consonant", symbols:"pP"}, � {type:"consonant", symbols:"qQ"}, � {type:"consonant", symbols:"rR"}, � {type:"consonant", symbols:"sS"}, � {type:"consonant", symbols:"tT"}, � {type:"vowel", symbols:"uU"}, � {type:"consonant", symbols:"vV"}, � {type:"consonant", symbols:"wW"}, � {type:"consonant", symbols:"xX"}, � {type:"vowel", symbols:"yY"}, � {type:"consonant", symbols:"zZ"}} property Mac_letters : {� {type:"vowel", symbols:"aA������������@"}, � {type:"consonant", symbols:"bB�"}, � {type:"consonant", symbols:"cC�ǩ�("}, � {type:"consonant", symbols:"dD"}, � {type:"vowel", symbols:"eE����??��?��"}, � {type:"consonant", symbols:"fF"}, � {type:"consonant", symbols:"gG"}, � {type:"consonant", symbols:"hH"}, � {type:"vowel", symbols:"iI�����?����"}, � {type:"consonant", symbols:"jJ"}, � {type:"consonant", symbols:"kK"}, � {type:"consonant", symbols:"lL�"}, � {type:"consonant", symbols:"mM"}, � {type:"consonant", symbols:"nN��??"}, � {type:"vowel", symbols:"oO���������?�����0"}, � {type:"consonant", symbols:"pP"}, � {type:"consonant", symbols:"qQ�"}, � {type:"consonant", symbols:"rR�"}, � {type:"consonant", symbols:"sS�??$"}, � {type:"consonant", symbols:"tT"}, � {type:"vowel", symbols:"uU���ܵ����"}, � {type:"consonant", symbols:"vV?"}, � {type:"consonant", symbols:"wW"}, � {type:"consonant", symbols:"xX"}, � {type:"vowel", symbols:"yY��?"}, � {type:"consonant", symbols:"zZ"}} property ISO8859_1_letters : {� {type:"vowel", symbols:"aA������������@"}, � {type:"consonant", symbols:"bB�"}, � {type:"consonant", symbols:"cC�ǩ�("}, � {type:"consonant", symbols:"dD"}, � {type:"vowel", symbols:"eE��������"}, � {type:"consonant", symbols:"fF"}, � {type:"consonant", symbols:"gG"}, � {type:"consonant", symbols:"hH"}, � {type:"vowel", symbols:"iI���������"}, � {type:"consonant", symbols:"jJ"}, � {type:"consonant", symbols:"kK"}, � {type:"consonant", symbols:"lL�"}, � {type:"consonant", symbols:"mM"}, � {type:"consonant", symbols:"nN��"}, � {type:"vowel", symbols:"oO��������������0"}, � {type:"consonant", symbols:"pP"}, � {type:"consonant", symbols:"qQ�"}, � {type:"consonant", symbols:"rR�"}, � {type:"consonant", symbols:"sS�?$"}, � {type:"consonant", symbols:"tT"}, � {type:"vowel", symbols:"uU���ܵ����"}, � {type:"consonant", symbols:"vV"}, � {type:"consonant", symbols:"wW"}, � {type:"consonant", symbols:"xX"}, � {type:"vowel", symbols:"yY��"}, � {type:"consonant", symbols:"zZ"}} on make_nerd(letter_table) (* script nerd nerd est un objet qui sait "parler" comme les hackers. Il connait le type des caract�res et sait quels caract�res de remplacement utiliser. *) script nerd property letters : letter_table (* on get_type for the_character Retourne le type de lettre : consonne, voyelle ou inconnu. - the_character : le caract�re dont on veut conna�tre le type. *) on get_type for the_character considering case repeat with i in letters if the_character is in symbols of i then return type of i end repeat return "unknown" end considering end get_type (* on get_upper for the_character Retourne la lettre majuscule correspondante. - the_character : le caract�re dont on veut la majuscule. *) on get_upper for the_character considering case repeat with i in letters if the_character is in symbols of i then return item 2 of symbols of i end repeat return the_character end considering end get_upper (* on give_term for the_word given upper_consonant_only:upper_consonant_only Retourne le texte nerd correspondant. - the_word : le texte original dont on veut une version nerd. - upper_consonant_only : un bool�en qui indique, quand il est vrai, que les consonnes ne peuvent �tre remplac�e que par les consonnes majuscules correspondantes. *) on give_term for the_word given upper_consonant_only:upper_consonant_only set the_result to "" considering case repeat with a_character in the_word set new_character to a_character repeat with l in letters if a_character is in symbols of l then if type of l is "consonant" and upper_consonant_only is true then set new_character to some item of (items 1 thru 2 of symbols of l) else set new_character to some item of symbols of l end if exit repeat end if end repeat set the_result to the_result & new_character end repeat end considering return the_result as text end give_term end script return nerd end make_nerd (* Ce programme demande � l'utilisateur le texte � traduire. ll propose par d�faut une phrase ou le contenu du Presse-Papiers quand celui-ci contient du texte. Il affiche le r�sultat en proposant � l'utilisateur de copier ce r�sultat dans le Presse-Papiers. *) on run set clipboard_info to clipboard info for string if clipboard_info is {} or item 2 of item 1 of clipboard_info is 0 then set default_text to some item of � {"Un bon nerd n'a pas encore de poil au menton.", � "Une bonne nerd n'est pas press�e d'avoir de l'acn�e"} else set default_text to the clipboard as string end if set dialog_response to display dialog � "Texte � traduire :" default answer default_text buttons {"Annuler", "Mac", "8859-1"} � default button "8859-1" giving up after 60 if button returned of dialog_response is "Annuler" then return set normal_text to text returned of dialog_response if normal_text is "" then return if button returned of dialog_response is "Mac" then set my_nerd to make_nerd(Mac_letters) else if button returned of dialog_response is "8859-1" then set my_nerd to make_nerd(ISO8859_1_letters) else set my_nerd to make_nerd(standard_letters) end if tell my_nerd set nerd_word to give_term for normal_text without upper_consonant_only end tell set dialog_response to display dialog some item of � {"Le nerd a dit :", "La nerd a dit :"} & return � & nerd_word buttons {"Presse-papiers", "OK"} � default button "OK" giving up after 60 if button returned of dialog_response is "Presse-papiers" then set the clipboard to nerd_word end if end run ATTENTION Le stress nuit autant a l'esperance de vie que la cigarette. N'attendez plus, prenez Planet ADSL. http://www.planetinternet.be/fr/products/specials/2001/adsl/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CCMC vous est offert par Emakina <http://www.emakina.com> Pour vous desabonner: <mailto:[EMAIL PROTECTED]>
