Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

À propos d'AppleScript ;-°((

42 réponses
Avatar
a.scnr
Bonjour

À force d'accumuler des actions répétitives, je me réveille, nom d'une
pipe! Et AppleScript alors ?

L'ayant oublié, la galère de reprise en main me bloque sur de vieux
scripts oubliés.

J'ai d'abord cru qu'AppleScript ne fonctionne plus sous Mavericks ??

Mais si, voyons, pour des actions au niveau du Finder, pas de soucis.

Mais "dans" une Application ouverte ????

- soit une Application ouverte
- j'ouvre l'éditeur de script.
- clic sur bouton d'enregistrement..
- clic sur menu préférences dans l'application ...
- rien
-l'éditeur de script reste amnésique et n'enregistre rien.

Où est l'erreur ????

Depuis, j'ai plongé tout habillé dans Automator, accroché aux multiples
bouées de tutoriels ..
Noyade ;-(

Une idée ? Un indice pour commencer ?

Merci d'avance aux pros du script, s'ils me lisent ;)-
Bonne journée.

p.s: But du "jeu": dans les Préférences du navigateur, pointer
l'onglet "Vie privée" et vider les cookies !!
--
RyanScan

10 réponses

1 2 3 4 5
Avatar
Une Bévue
Le 15/07/2015 12:05, Fleuger a écrit :
pourrais-tu poster le script corrigé par tes soins pour avoir
les majuscules aux endroits idoines ?




Bon, la version Ruby d'abord (notez que je n'ai pas cherché à finasser,
c'est une sorte de traduction "littérale" de l'AppleScript) :

--------------------------------------------------------------------------------

#!/usr/bin/env ruby
# encoding: utf-8

require 'rubygems'

##############################################################################################
###
###
### From:
https://groups.google.com/d/msg/fr.comp.os.mac-os.x/ph6oTyTlttc/JO0jvxTC0ScJ
###
###
###
##############################################################################################

@verbs_list = [["accéder", "2"], ["accélérer", "2"], ["ajuster", "2"],
["améliorer", "2"], ["amplifier", "2"], ["analyser", "2"],
["annuler", "2"], ["bouffoner", "2"], ["bouillir", "2"], ["calcifrer",
"2"], ["compresser", "2"], ["créer", "2"], ["décélérer", "2"],
["décoder", "2"], ["décrypter", "2"], ["déstabiliser", "2"],
["détecter", "2"], ["diminuer", "2"], ["dupliquer", "2"], ["encoder",
"2"], ["encrypter", "2"], ["fracasser", "2"], ["induire", "2"],
["inhiber", "2"], ["inverser", "2"], ["ioniser", "2"], ["moduler", "2"],
["neutraliser", "2"], ["optimiser", "2"], ["phaser", "2"], ["polariser",
"2"], ["pournifier", "2"], ["réarranger", "2"], ["recombiner", "2"],
["recréer", "2"], ["rediriger", "2"], ["relayer", "2"], ["scanner",
"2"], ["signaler", "2"], ["stabiliser", "2"], ["surcharger", "2"],
["transformer", "2"], ["trouer", "2"], ["zombifier", "2"]]

#puts @verbs_list

@adjective_list = [
["à court rayon d'action", "à court rayon d'action", "0"],
["à grand rayon d'action", "à grand rayon d'action", "0"],
["à haute vitesse", "à haute vitesse", "0"],
["adaptatif", "adaptative", "2"],
["alternatif", "alternative", "2"],
["alvéolé", "alvéolée", "2"],
["artificiel", "artificielle", "2"],
["atomique", "atomique", "2"],
["baleiné", "baleinée", "2"],
["ballistique", "ballistique", "2"],
["basse vitesse", "basse vitesse", "2"],
["binaire", "binaire", "2"],
["bouffoné", "bouffonée", "2"],
["calorifique", "calorifique", "2"],
["carpien", "carpienne", "2"],
["centrique", "centrique", "2"],
["compressé", "compressée", "2"],
["connotatif", "connotative", "2"],
["corporel", "corporelle", "2"],
["cythérien", "cythérienne", "2"],
["dimensionnel", "dimensionnelle", "2"],
["directionnel", "directionnelle", "2"],
["dirigé", "dirigée", "2"],
["dynamique", "dynamique", "2"],
["encrypté", "encryptée", "2"],
["génique", "génique", "2"],
["gildoique", "gildoique", "2"],
["gravifique", "gravifique", "2"],
["gravitationnel", "gravitationnelle", "2"],
["holographique", "holographique", "2"],
["instable", "instable", "2"],
["interstellaire", "interstellaire", "2"],
["ionisé", "ionisée", "2"],
["linéaire", "linéaire", "2"],
["localisé", "localisée", "2"],
["magnétique", "magnétique", "2"],
["mécanique", "mécanique", "2"],
["microscopique", "microscopique", "2"],
["modulaire", "modulaire", "2"],
["moléculaire", "moléclaire", "2"],
["moncturien", "moncturienne", "2"],
["navigationnel", "navigationnelle", "2"],
["oblatif", "oblative", "2"],
["ossiphazolé", "ossiphazolée", "2"],
["parabolique", "parabolique", "2"],
["parallele", "parallele", "2"],
["phasé", "phasée", "2"],
["phasique", "phasique", "2"],
["plutonnant", "plutonnante", "2"],
["plutonné", "plutonnée", "2"],
["pourniflant", "pourniflante", "2"],
["quantique", "quantique", "2"],
["refroidi", "refroidie", "2"],
["réplicatif", "réplicative", "2"],
["résistant", "résistante", "2"],
["résonnant", "résonnante", "2"],
["spatial", "spatiale", "2"],
["spinoidal", "spinoidale", "2"],
["statique", "statique", "2"],
["stellaire", "stellaire", "2"],
["temporel", "temporelle", "2"],
["trigloidal", "trigloidale", "2"],
["valvué", "valvuée", "2"],
["véloce", "véloce", "2"],
["vibratile", "vibratile", "2"]
]

#puts @adjective_list

@noun_list = [
["aimant", "1", "2"], ["alignement", "1", "2"],
["amplificateur", "1", "2"], ["anihilateur", "1", "2"], ["capsule", "2",
"2"], ["assimilateur", "1", "2"], ["balise", "2", "2"], ["bouclier",
"1", "2"], ["bouffon", "1", "2"], ["buffer", "1", "2"], ["calcifrage",
"1", "2"], ["capacité", "2", "2"], ["capilectomie", "2", "2"],
["causalité", "2", "2"], ["chambre", "2", "2"], ["champ", "1", "2"],
["champ de force", "1", "2"], ["coeur", "1", "2"], ["conduit", "1",
"2"], ["configuration", "2", "2"], ["continuum", "1", "2"],
["convertisseur", "1", "2"], ["corridor", "1", "2"], ["crevasse", "2",
"2"], ["cristal", "1", "2"], ["cybergement", "1", "2"], ["déflecteur",
"1", "2"], ["désintégrateur", "1", "2"], ["détonateur", "1", "2"],
["diagnostic", "1", "2"], ["disrupteur", "1", "2"], ["distortion", "2",
"2"], ["écho", "1", "2"], ["efficience", "2", "2"], ["émission", "2",
"2"], ["endiguement", "1", "2"], ["énergie", "2", "2"], ["entité", "2",
"2"], ["filament", "1", "2"], ["filtre", "1", "2"], ["flot", "1", "2"],
["flux", "1", "2"], ["force", "2", "2"], ["formation", "2", "2"],
["fragment", "1", "2"], ["fragmenticule", "1", "2"], ["fréquence", "2",
"2"], ["gain", "1", "2"], ["générateur", "1", "2"], ["gicleur", "1",
"2"], ["glomérule", "2", "2"], ["goniotron", "1", "2"], ["graviton",
"1", "2"], ["grille", "2", "2"], ["hologramme", "1", "2"], ["impulsion",
"2", "2"], ["incursion", "2", "2"], ["inducteur", "1", "2"], ["inertie",
"1", "2"], ["inhibiteur", "1", "2"], ["laplaxmol", "1", "2"],
["matiere", "2", "2"], ["matrice", "2", "2"], ["mécanisme", "1", "2"],
["mine", "2", "2"], ["mitochondrie", "2", "2"], ["moteur", "1", "2"],
["moulinotron", "1", "2"], ["multiplexeur", "1", "2"], ["nacelle", "2",
"2"], ["noyau", "1", "2"], ["nuage", "1", "2"], ["ordinateur", "1",
"2"], ["papsouille", "2", "2"], ["parallax", "1", "2"], ["particule",
"2", "2"], ["plasma", "1", "2"], ["plutonneur", "1", "2"], ["porteuse",
"2", "2"], ["poussée", "2", "2"], ["radiation", "2", "2"], ["rayon",
"1", "2"], ["réhausseur", "1", "2"], ["relai", "1", "2"], ["rémouleur",
"1", "2"], ["réplicateur", "1", "2"], ["réplication", "2", "2"],
["réseau", "1", "2"], ["résonnateur", "1", "2"], ["ressort", "1", "2"],
["rotation", "2", "2"], ["schisme", "1", "2"], ["séquence", "2", "2"],
["signal", "1", "2"], ["signature", "2", "2"], ["singularité", "2",
"2"], ["sonde", "2", "2"], ["spouniseur", "1", "2"], ["survolteur", "1",
"2"], ["sustentation", "2", "2"], ["syntagme", "1", "2"], ["tachyon",
"1", "2"], ["transistor", "1", "2"], ["translateur", "1", "2"],
["transporteur", "1", "2"], ["trigloide", "1", "2"], ["trophoblaste",
"1", "2"], ["tropisme", "1", "2"], ["tube", "1", "2"], ["tunnel", "1",
"2"], ["turbulence", "1", "2"], ["vagissement", "1", "2"], ["vague",
"2", "2"], ["vibration", "2", "2"], ["vide", "1", "2"], ["vortex", "1",
"2"]
]

#puts @noun_list

@prefix_list = [
"aéro", "ana", "anti", "auto", "bi", "bulbo",
"capillo", "crypto", "extra", "hepta", "hétéro", "homo", "méta",
"micro", "morpho", "morvo", "multi", "néo", "non", "nucléo", "octo",
"penta", "poly", "proto", "pseudo", "puslo", "quadri", "rétro", "servo",
"spiro", "sub", "sur", "thermo", "theta", "trans", "tri", "turbo",
"ultra"
]

#puts @prefix_list

@gabarit_list = ["Si nous pouvons [v] [n] [a], nous devrions pouvoir [v]
[n] [a] et [v] [n] [a] !",
"Capitaine, je ne peux pas [v] [n] parce que [n] [a] est sur le point
[d] [n] [a] !",
"[v] [n] [a] est illogique, puisque [n] [a] va [v] [n] [a].",
"Il est possible que [n] [a] puisse [v] [n] [a], mais seulement si
nous pouvons [v] [n] [a] et [v] [n] [a] !",
"Pas de panique ! [v] [n] [a] ne nous empêche pas [d] [n] [a] ni même
[d] [n] [a].",
"Voici [n] [a] dont il est temps [d] [n] [a] sans oublier [d] [n] [a].",
"Damned, [n] [a] ne peut pas [v] [n] [a] ! Nous allons être obligé
[d] [n] [a]...",
"Tout va bien a bord. [n] [a] semble [v] correctement. Mais nous
devrions [v] [n] [a] pour plus de sécurité.",
"Alerte ! [n] [a] semble [v] dangereusement ! Il faut [v] [n] [a]
d'urgence !!!",
"Veuillez [v] [n] [a] avant [d] sciemment."]

#puts @gabarit_list

def alea
return rand(2)
end

def check_Voyelle the_word
voyels = %w[a e i o u y é h]
return voyels.include? the_word[0, 1]
end

def substitute_Prefix()
return @prefix_list[rand(@prefix_list.length)]
end

def substitute_Verb prep
theVerb = @verbs_list[rand(@verbs_list.length)]
idx = theVerb[1].to_i
theVerb = theVerb[0]
case idx
when 1 then theVerb = substitute_Prefix() + "-" + theVerb
when 2
if alea == 1
theVerb = substitute_Prefix() + "-" + theVerb
end
end
if prep == 1
if check_Voyelle theVerb
theVerb = "d'" + theVerb
else
theVerb = "de " + theVerb
end
end
#puts "theVerb = #{theVerb}"
return theVerb
end

def substitute_Adj adjGenre
the_x = rand(@adjective_list.length)
if adjGenre == 1
return @adjective_list[the_x][0]
else
return @adjective_list[the_x][1]
end
end

def get_Gabarit
return @gabarit_list[rand(@gabarit_list.length)]
end

def substitute_noun(genre, withAdj)
the_x = rand(@noun_list.length)
the_noun = @noun_list[the_x][0]
currGenre = @noun_list[the_x][1].to_i
if genre != 0 && genre != currGenre
the_noun = substitute_noun(genre, withAdj)
else
if @noun_list[the_x][2].to_i == 1
the_noun = substitute_Prefix() + "-" + the_noun
elsif @noun_list[the_x][2].to_i == 2
the_noun = substitute_Prefix() + "-" + the_noun if alea() == 1
end
if withAdj == 1
the_noun = the_noun + " " + substitute_Adj(currGenre)
end
end
if check_Voyelle(the_noun)
the_noun = "l'" + the_noun
elsif currGenre == 1
the_noun = "le " + the_noun
else
the_noun = "la " + the_noun
end
return the_noun
end

def noun_with_adj(phrase, counter)
cResult = 0
counter += 4
numChars = phrase.length
cResult = 1 if (counter < numChars - 2) && phrase[counter - 1, 3] == "[a]"
return cResult
end

def corvo()
start_phrase = get_Gabarit()
#puts "start_phrase = '#{start_phrase}'"
res_phrase = ""

numChars = start_phrase.length
x = 0
while x < numChars # - 1
x += 1
tempWord = start_phrase[x - 1, 3]
#puts "x = #{x}"
#puts "tempWord = '#{tempWord}'"
#puts "tempWord.length = #{tempWord.length}"
#puts "res_phrase = '#{res_phrase}'"
if tempWord == "[v]" # verb
res_phrase = res_phrase + substitute_Verb(0)
x += 2
elsif tempWord == "[n]" # noun
if noun_with_adj(start_phrase, x) == 1
res_phrase = res_phrase + substitute_noun(0, 1)
x += 6
else
res_phrase = res_phrase + substitute_noun(0, 0)
x += 2
end
elsif tempWord == "[a]" # adj
res_phrase = res_phrase + substitute_Adj(0)
x += 2
elsif tempWord == "[d]" # verb with preposition
res_phrase = res_phrase + substitute_Verb(1)
x += 2
elsif tempWord == "[m]" # masc noun
if noun_with_adj(start_phrase, x) == 1
res_phrase = res_phrase + substitute_noun(1, 1)
x += 6
else
res_phrase = res_phrase + substitute_noun(1, 0)
x += 2
end
elsif tempWord == "[f]" # femin noun
if noun_with_adj(start_phrase, x) == 1
res_phrase = res_phrase + substitute_noun(2, 1)
x += 6
else
res_phrase = res_phrase + substitute_noun(2, 0)
x += 2
end
else
res_phrase = res_phrase + start_phrase[x -1, 1]
end
end
#puts "start_phrase[#{x - 1}, #{numChars - 1 - x}] = #{start_phrase[x
- 1, numChars - x]}"
res_phrase = res_phrase + start_phrase[x - 1, numChars - x]
numChars = res_phrase.length
x = 2
puncts = %w[. ! ?]
#puts "puncts = #{puncts}"
res = res_phrase[0, 2].capitalize
#puts res_phrase
while x < numChars
res += (puncts.include? res_phrase[x - 2])? res_phrase[x].upcase :
res_phrase[x]
x += 1
end
return res
end

puts corvo

--------------------------------------------------------------------------------

Je posterai + tard la version AppleScript ))
Avatar
Une Bévue
Le 15/07/2015 12:05, Fleuger a écrit :
poster le script corrigé



le script en AppleScript :
--------------------------------------------------------------------------------
property verbs_list : {{"accéder", "2"}, {"accélérer", "2"}, {"ajuster", ¬
"2"}, {"améliorer", "2"}, {"amplifier", "2"}, {"analyser", "2"}, ¬
{"annuler", "2"}, {"bouffoner", "2"}, {"bouillir", "2"}, {"calcifrer", ¬
"2"}, {"compresser", "2"}, {"créer", "2"}, {"décélérer", "2"}, ¬
{"décoder", "2"}, {"décrypter", "2"}, {"déstabiliser", "2"}, ¬
{"détecter", "2"}, {"diminuer", "2"}, {"dupliquer", "2"}, {"encoder", ¬
"2"}, {"encrypter", "2"}, {"fracasser", "2"}, {"induire", "2"}, ¬
{"inhiber", "2"}, {"inverser", "2"}, {"ioniser", "2"}, {"moduler", "2"}, ¬
{"neutraliser", "2"}, {"optimiser", "2"}, {"phaser", "2"}, {"polariser", ¬
"2"}, {"pournifier", "2"}, {"réarranger", "2"}, {"recombiner", "2"}, ¬
{"recréer", "2"}, {"rediriger", "2"}, {"relayer", "2"}, {"scanner", ¬
"2"}, {"signaler", "2"}, {"stabiliser", "2"}, {"surcharger", "2"}, ¬
{"transformer", "2"}, {"trouer", "2"}, {"zombifier", "2"}}

property adjective_list : {{"à court rayon d'action", "à court rayon
d'action", "0"}, {"à grand rayon d'action", "à grand rayon d'action", ¬
"0"}, {"à haute vitesse", "à haute vitesse", "0"}, {"adaptatif", ¬
"adaptative", "2"}, {"alternatif", "alternative", "2"}, {"alvéolé", ¬
"alvéolée", "2"}, {"artificiel", "artificielle", "2"}, {"atomique", ¬
"atomique", "2"}, {"baleiné", "baleinée", "2"}, {"ballistique", ¬
"ballistique", "2"}, {"basse vitesse", "basse vitesse", "2"}, ¬
{"binaire", "binaire", "2"}, {"bouffoné", "bouffonée", "2"}, ¬
{"calorifique", "calorifique", "2"}, {"carpien", "carpienne", "2"}, ¬
{"centrique", "centrique", "2"}, {"compressé", "compressée", "2"}, ¬
{"connotatif", "connotative", "2"}, {"corporel", "corporelle", "2"}, ¬
{"cythérien", "cythérienne", "2"}, {"dimensionnel", "dimensionnelle", ¬
"2"}, {"directionnel", "directionnelle", "2"}, {"dirigé", "dirigée", ¬
"2"}, {"dynamique", "dynamique", "2"}, {"encrypté", "encryptée", "2"}, ¬
{"génique", "génique", "2"}, {"gildoique", "gildoique", "2"}, ¬
{"gravifique", "gravifique", "2"}, {"gravitationnel", ¬
"gravitationnelle", "2"}, {"holographique", "holographique", "2"}, ¬
{"instable", "instable", "2"}, {"interstellaire", "interstellaire", ¬
"2"}, {"ionisé", "ionisée", "2"}, {"linéaire", "linéaire", "2"}, ¬
{"localisé", "localisée", "2"}, {"magnétique", "magnétique", "2"}, ¬
{"mécanique", "mécanique", "2"}, {"microscopique", "microscopique", ¬
"2"}, {"modulaire", "modulaire", "2"}, {"moléculaire", "moléclaire", ¬
"2"}, {"moncturien", "moncturienne", "2"}, {"navigationnel", ¬
"navigationnelle", "2"}, {"oblatif", "oblative", "2"}, {"ossiphazolé", ¬
"ossiphazolée", "2"}, {"parabolique", "parabolique", "2"}, {"parallele", ¬
"parallele", "2"}, {"phasé", "phasée", "2"}, {"phasique", "phasique", ¬
"2"}, {"plutonnant", "plutonnante", "2"}, {"plutonné", "plutonnée", ¬
"2"}, {"pourniflant", "pourniflante", "2"}, {"quantique", "quantique", ¬
"2"}, {"refroidi", "refroidie", "2"}, {"réplicatif", "réplicative", ¬
"2"}, {"résistant", "résistante", "2"}, {"résonnant", "résonnante", ¬
"2"}, {"spatial", "spatiale", "2"}, {"spinoidal", "spinoidale", "2"}, ¬
{"statique", "statique", "2"}, {"stellaire", "stellaire", "2"}, ¬
{"temporel", "temporelle", "2"}, {"trigloidal", "trigloidale", "2"}, ¬
{"valvué", "valvuée", "2"}, {"véloce", "véloce", "2"}, {"vibratile", ¬
"vibratile", "2"}}

property noun_list : {{"aimant", "1", "2"}, {"alignement", "1", "2"}, ¬
{"amplificateur", "1", "2"}, {"anihilateur", "1", "2"}, {"capsule", "2", ¬
"2"}, {"assimilateur", "1", "2"}, {"balise", "2", "2"}, {"bouclier", ¬
"1", "2"}, {"bouffon", "1", "2"}, {"buffer", "1", "2"}, {"calcifrage", ¬
"1", "2"}, {"capacité", "2", "2"}, {"capilectomie", "2", "2"}, ¬
{"causalité", "2", "2"}, {"chambre", "2", "2"}, {"champ", "1", "2"}, ¬
{"champ de force", "1", "2"}, {"coeur", "1", "2"}, {"conduit", "1", ¬
"2"}, {"configuration", "2", "2"}, {"continuum", "1", "2"}, ¬
{"convertisseur", "1", "2"}, {"corridor", "1", "2"}, {"crevasse", "2", ¬
"2"}, {"cristal", "1", "2"}, {"cybergement", "1", "2"}, {"déflecteur", ¬
"1", "2"}, {"désintégrateur", "1", "2"}, {"détonateur", "1", "2"}, ¬
{"diagnostic", "1", "2"}, {"disrupteur", "1", "2"}, {"distortion", "2", ¬
"2"}, {"écho", "1", "2"}, {"efficience", "2", "2"}, {"émission", "2", ¬
"2"}, {"endiguement", "1", "2"}, {"énergie", "2", "2"}, {"entité", "2", ¬
"2"}, {"filament", "1", "2"}, {"filtre", "1", "2"}, {"flot", "1", "2"}, ¬
{"flux", "1", "2"}, {"force", "2", "2"}, {"formation", "2", "2"}, ¬
{"fragment", "1", "2"}, {"fragmenticule", "1", "2"}, {"fréquence", "2", ¬
"2"}, {"gain", "1", "2"}, {"générateur", "1", "2"}, {"gicleur", "1", ¬
"2"}, {"glomérule", "2", "2"}, {"goniotron", "1", "2"}, {"graviton", ¬
"1", "2"}, {"grille", "2", "2"}, {"hologramme", "1", "2"}, {"impulsion", ¬
"2", "2"}, {"incursion", "2", "2"}, {"inducteur", "1", "2"}, {"inertie", ¬
"1", "2"}, {"inhibiteur", "1", "2"}, {"laplaxmol", "1", "2"}, ¬
{"matiere", "2", "2"}, {"matrice", "2", "2"}, {"mécanisme", "1", "2"}, ¬
{"mine", "2", "2"}, {"mitochondrie", "2", "2"}, {"moteur", "1", "2"}, ¬
{"moulinotron", "1", "2"}, {"multiplexeur", "1", "2"}, {"nacelle", "2", ¬
"2"}, {"noyau", "1", "2"}, {"nuage", "1", "2"}, {"ordinateur", "1", ¬
"2"}, {"papsouille", "2", "2"}, {"parallax", "1", "2"}, {"particule", ¬
"2", "2"}, {"plasma", "1", "2"}, {"plutonneur", "1", "2"}, {"porteuse", ¬
"2", "2"}, {"poussée", "2", "2"}, {"radiation", "2", "2"}, {"rayon", ¬
"1", "2"}, {"réhausseur", "1", "2"}, {"relai", "1", "2"}, {"rémouleur", ¬
"1", "2"}, {"réplicateur", "1", "2"}, {"réplication", "2", "2"}, ¬
{"réseau", "1", "2"}, {"résonnateur", "1", "2"}, {"ressort", "1", "2"}, ¬
{"rotation", "2", "2"}, {"schisme", "1", "2"}, {"séquence", "2", "2"}, ¬
{"signal", "1", "2"}, {"signature", "2", "2"}, {"singularité", "2", ¬
"2"}, {"sonde", "2", "2"}, {"spouniseur", "1", "2"}, {"survolteur", "1", ¬
"2"}, {"sustentation", "2", "2"}, {"syntagme", "1", "2"}, {"tachyon", ¬
"1", "2"}, {"transistor", "1", "2"}, {"translateur", "1", "2"}, ¬
{"transporteur", "1", "2"}, {"trigloide", "1", "2"}, {"trophoblaste", ¬
"1", "2"}, {"tropisme", "1", "2"}, {"tube", "1", "2"}, {"tunnel", "1", ¬
"2"}, {"turbulence", "1", "2"}, {"vagissement", "1", "2"}, {"vague", ¬
"2", "2"}, {"vibration", "2", "2"}, {"vide", "1", "2"}, {"vortex", "1", ¬
"2"}}

property prefix_list : {"aéro", "ana", "anti", "auto", "bi", "bulbo", ¬
"capillo", "crypto", "extra", "hepta", "hétéro", "homo", "méta", ¬
"micro", "morpho", "morvo", "multi", "néo", "non", "nucléo", "octo", ¬
"penta", "poly", "proto", "pseudo", "puslo", "quadri", "rétro", "servo", ¬
"spiro", "sub", "sur", "thermo", "theta", "trans", "tri", "turbo", ¬
"ultra"}

property gabarit_list : {"Si nous pouvons [v] [n] [a], nous devrions
pouvoir [v] [n] [a] et [v] [n] [a] !", "Capitaine, je ne peux pas [v]
[n] parce que [n] [a] est sur le point [d] [n] [a] !", "[v] [n] [a] est
illogique, puisque [n] [a] va [v] [n] [a].", "Il est possible que [n]
[a] puisse [v] [n] [a], mais seulement si nous pouvons [v] [n] [a] et
[v] [n] [a] !", "Pas de panique ! [v] [n] [a] ne nous empêche pas [d]
[n] [a] ni même [d] [n] [a].", "Voici [n] [a] dont il est temps [d] [n]
[a] sans oublier [d] [n] [a].", "Damned, [n] [a] ne peut pas [v] [n] [a]
! Nous allons être obligé [d] [n] [a]...", "Tout va bien a bord. [n] [a]
semble [v] correctement. Mais nous devrions [v] [n] [a] pour plus de
sécurité.", "Alerte ! [n] [a] semble [v] dangereusement ! Il faut [v]
[n] [a] d'urgence !!!", "Veuillez [v] [n] [a] avant [d] sciemment."}

property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"
property PUNCTS : ".!?"

--
https://groups.google.com/d/msg/fr.comp.os.mac-os.x/ph6oTyTlttc/JO0jvxTC0ScJ

on substitute_Verb(prep)
set the_x to random number from 1 to the count of verbs_list
set theVerb to item 1 of item the_x of verbs_list as string
if item 2 of item the_x of verbs_list is "1" then
set theVerb to substitute_Prefix() & "-" & theVerb
else if item 2 of item the_x of verbs_list is "2" then
if alea() is 1 then set theVerb to substitute_Prefix() & "-" & theVerb
end if
if prep is 1 then
if check_Voyelle(theVerb) is true then
set theVerb to "d'" & theVerb
else
set theVerb to "de " & theVerb
end if
end if
return theVerb
end substitute_Verb

on substitute_Adj(adjGenre)
set the_x to random number from 1 to the count of adjective_list
if adjGenre = 1 then
set the_adj to item 1 of item the_x of adjective_list as string
else
set the_adj to item 2 of item the_x of adjective_list as string
end if
return the_adj
end substitute_Adj

on substitute_noun(genre, withAdj)
set the_x to random number from 1 to the count of noun_list
set the_noun to item 1 of item the_x of noun_list as string
set currGenre to item 2 of item the_x of noun_list as integer
if genre ≠ 0 and genre is not currGenre then
set the_noun to substitute_noun(genre, withAdj)
else
if item 3 of item the_x of noun_list is "1" then
set the_noun to substitute_Prefix() & "-" & the_noun
else if item 3 of item the_x of noun_list is "2" then
if alea() is 1 then set the_noun to substitute_Prefix() & "-" & the_noun
end if
if withAdj is 1 then
set the_noun to the_noun & " " & substitute_Adj(currGenre)
end if
end if
if check_Voyelle(the_noun) is true then
set the_noun to "l'" & the_noun
else if currGenre is 1 then
set the_noun to "le " & the_noun
else
set the_noun to "la " & the_noun
end if
return the_noun
end substitute_noun

on substitute_Prefix()
set the_x to random number from 1 to the count of prefix_list
return item the_x of prefix_list as string
end substitute_Prefix

on get_Gabarit()
set the_x to random number from 1 to the count of gabarit_list
return item the_x of gabarit_list as string
end get_Gabarit

on check_Voyelle(the_word)
if character 1 of the_word is in {"a", "e", "i", "o", "u", "y", "é",
"h"} then
return true
else
return false
end if
end check_Voyelle

on alea()
return random number from 0 to 1
end alea

on noun_with_adj(Phrase, counter)
set cResult to 0
set counter to counter + 4
set numChars to (count characters of Phrase)
if counter < numChars - 2 and text counter thru (counter + 2) of Phrase
is "[a]" then set cResult to 1
return cResult
end noun_with_adj

on lower2Upper(theChar)
if theChar is in LC then set theChar to item (offset of theChar in LC)
of UC
return theChar as string
end lower2Upper

on corvo()
set startPhrase to get_Gabarit()
set resPhrase to ""

set numChars to (count characters of startPhrase)
set x to 0 as integer
repeat while x < numChars - 2
set x to x + 1
set tempWord to text x thru (x + 2) of startPhrase
if tempWord is "[v]" then --verb
set resPhrase to resPhrase & substitute_Verb(0)
set x to x + 2
else if tempWord is "[n]" then --noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(0, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(0, 0)
set x to x + 2
end if
else if tempWord is "[a]" then --adj
set resPhrase to resPhrase & substitute_Adj(0)
set x to x + 2
else if tempWord is "[d]" then --verb with preposition
set resPhrase to resPhrase & substitute_Verb(1)
set x to x + 2
else if tempWord is "[m]" then --masc noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(1, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(1, 0)
set x to x + 2
end if
else if tempWord is "[f]" then --femin noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(2, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(2, 0)
set x to x + 2
end if
else
set resPhrase to resPhrase & character x of startPhrase
end if
end repeat
set resPhrase to resPhrase & text (x + 1) thru numChars of startPhrase

set numChars to (count characters of resPhrase)
set corPhrase to lower2Upper(item 1 of resPhrase)
set corPhrase to corPhrase & item 2 of resPhrase
set x to 3 as integer

repeat while x < numChars
set theChar to item x of resPhrase
if (item (x - 2) of resPhrase) is in PUNCTS then set theChar to
lower2Upper(theChar)
set corPhrase to corPhrase & theChar
set x to x + 1
end repeat
return corPhrase
end corvo

on substitute()
set result to corvo()
return result
end substitute

set the clipboard to corvo()

corvo()



tell application "TextEdit"
activate
delay 0.5
tell application "System Events"
activate
keystroke "v" using command down
keystroke return
keystroke return
set visible of process "TextEdit" to false
delay 0.5
set frontmost of process "TextEdit" to true
end tell
end tell
--------------------------------------------------------------------------------


ce qu'il y a de d'ajouté :

3 properties :
property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"
property PUNCTS : ".!?"

1 function :
on lower2Upper(theChar)
if theChar is in LC then set theChar to item (offset of theChar in LC) of UC
return theChar as string
end lower2Upper


et une partie modifiée, je corrige resPhrase en corPhrase par :
set numChars to (count characters of resPhrase)
set corPhrase to lower2Upper(item 1 of resPhrase)
set corPhrase to corPhrase & item 2 of resPhrase
set x to 3 as integer

repeat while x < numChars
set theChar to item x of resPhrase
if (item (x - 2) of resPhrase) is in PUNCTS then set theChar to
lower2Upper(theChar)
set corPhrase to corPhrase & theChar
set x to x + 1
end repeat


et bien sûr je retourne corPhrase au lieu de resPhrase :
return corPhrase
Avatar
Une Bévue
Le 15/07/2015 17:40, Une Bévue a écrit :
property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"



à vérifier par tous que j'ai bien utilisé toutes les lettres accentuées
utilisées en french ))
Avatar
michel.vauquois
Une Bévue wrote:

à vérifier par tous que j'ai bien utilisé toutes les lettres accentuées
utilisées en french



Manque le Ç !
--
Michel Vauquois
Que Dieu vous garde... Moi j'ai pas le temps (RD)
MàJ 2015 : http://michelvauquois.free-h.fr/
Avatar
Une Bévue
Le 15/07/2015 18:04, M.V. a écrit :
Manque le Ç !


bien vu !
Avatar
g4fleurot
Une Bévue wrote:

> Manque le Ç !
bien vu !


et le ç

Avant de copier le script dans MacSoup, il faut cliquer sur le bouton
Options en haut à droite pour régler une longueur de lignes qui
n'introduise pas des retours à la ligne intempestifs ou alors, dans le
script, il faut couper les lignes supérieurs à 72 caractères avec le
caractère ¬
(le copié / collé du script brut ne veut pas se compiler)

Le srcipt introduit des retours à la ligne intempestifs dans TextEdit :
exemples

Tout va bien a bord. Le rayon calorifique
semble inhiber correctement. Mais nous devrions hétéro-recombiner le
plutonneur spatial pour plus de
sécurité

Il est possible que la puslo-distortion localisée puisse induire le
tunnel atomique, mais seulement si nous pouvons signaler le moteur
binaire et
moduler la distortion oblative

--
Gérard FLEUROT plus un
Avatar
g4fleurot
Une Bévue wrote:

à vérifier par tous que j'ai bien utilisé toutes les lettres accentuées
utilisées en french ))



-------------------------
property verbs_list : {{"accéder", "2"}, {"accélérer", "2"}, {"ajuster", ¬
"2"}, {"améliorer", "2"}, {"amplifier", "2"}, {"analyser", "2"}, ¬
{"annuler", "2"}, {"bouffoner", "2"}, {"bouillir", "2"}, {"calcifrer", ¬
"2"}, {"compresser", "2"}, {"créer", "2"}, {"décélérer", "2"}, ¬
{"décoder", "2"}, {"décrypter", "2"}, {"déstabiliser", "2"}, ¬
{"détecter", "2"}, {"diminuer", "2"}, {"dupliquer", "2"}, {"encoder", ¬
"2"}, {"encrypter", "2"}, {"fracasser", "2"}, {"induire", "2"}, ¬
{"inhiber", "2"}, {"inverser", "2"}, {"ioniser", "2"}, {"moduler", "2"}, ¬
{"neutraliser", "2"}, {"optimiser", "2"}, {"phaser", "2"}, {"polariser", ¬
"2"}, {"pournifier", "2"}, {"réarranger", "2"}, {"recombiner", "2"}, ¬
{"recréer", "2"}, {"rediriger", "2"}, {"relayer", "2"}, {"scanner", ¬
"2"}, {"signaler", "2"}, {"stabiliser", "2"}, {"surcharger", "2"}, ¬
{"transformer", "2"}, {"trouer", "2"}, {"zombifier", "2"}}

property adjective_list : {{"à court rayon d'action", "à court rayon
d'action", "0"}, {"à grand rayon d'action", "à grand rayon d'action", ¬
"0"}, {"à haute vitesse", "à haute vitesse", "0"}, {"adaptatif", ¬
"adaptative", "2"}, {"alternatif", "alternative", "2"}, {"alvéolé", ¬
"alvéolée", "2"}, {"artificiel", "artificielle", "2"}, {"atomique", ¬
"atomique", "2"}, {"baleiné", "baleinée", "2"}, {"ballistique", ¬
"ballistique", "2"}, {"basse vitesse", "basse vitesse", "2"}, ¬
{"binaire", "binaire", "2"}, {"bouffoné", "bouffonée", "2"}, ¬
{"calorifique", "calorifique", "2"}, {"carpien", "carpienne", "2"}, ¬
{"centrique", "centrique", "2"}, {"compressé", "compressée", "2"}, ¬
{"connotatif", "connotative", "2"}, {"corporel", "corporelle", "2"}, ¬
{"cythérien", "cythérienne", "2"}, {"dimensionnel", "dimensionnelle", ¬
"2"}, {"directionnel", "directionnelle", "2"}, {"dirigé", "dirigée", ¬
"2"}, {"dynamique", "dynamique", "2"}, {"encrypté", "encryptée", "2"}, ¬
{"génique", "génique", "2"}, {"gildoique", "gildoique", "2"}, ¬
{"gravifique", "gravifique", "2"}, {"gravitationnel", ¬
"gravitationnelle", "2"}, {"holographique", "holographique", "2"}, ¬
{"instable", "instable", "2"}, {"interstellaire", "interstellaire", ¬
"2"}, {"ionisé", "ionisée", "2"}, {"linéaire", "linéaire", "2"}, ¬
{"localisé", "localisée", "2"}, {"magnétique", "magnétique", "2"}, ¬
{"mécanique", "mécanique", "2"}, {"microscopique", "microscopique", ¬
"2"}, {"modulaire", "modulaire", "2"}, {"moléculaire", "moléclaire", ¬
"2"}, {"moncturien", "moncturienne", "2"}, {"navigationnel", ¬
"navigationnelle", "2"}, {"oblatif", "oblative", "2"}, {"ossiphazolé", ¬
"ossiphazolée", "2"}, {"parabolique", "parabolique", "2"}, {"parallele", ¬
"parallele", "2"}, {"phasé", "phasée", "2"}, {"phasique", "phasique", ¬
"2"}, {"plutonnant", "plutonnante", "2"}, {"plutonné", "plutonnée", ¬
"2"}, {"pourniflant", "pourniflante", "2"}, {"quantique", "quantique", ¬
"2"}, {"refroidi", "refroidie", "2"}, {"réplicatif", "réplicative", ¬
"2"}, {"résistant", "résistante", "2"}, {"résonnant", "résonnante", ¬
"2"}, {"spatial", "spatiale", "2"}, {"spinoidal", "spinoidale", "2"}, ¬
{"statique", "statique", "2"}, {"stellaire", "stellaire", "2"}, ¬
{"temporel", "temporelle", "2"}, {"trigloidal", "trigloidale", "2"}, ¬
{"valvué", "valvuée", "2"}, {"véloce", "véloce", "2"}, {"vibratile", ¬
"vibratile", "2"}}

property noun_list : {{"aimant", "1", "2"}, {"alignement", "1", "2"}, ¬
{"amplificateur", "1", "2"}, {"anihilateur", "1", "2"}, {"capsule", "2", ¬
"2"}, {"assimilateur", "1", "2"}, {"balise", "2", "2"}, {"bouclier", ¬
"1", "2"}, {"bouffon", "1", "2"}, {"buffer", "1", "2"}, {"calcifrage", ¬
"1", "2"}, {"capacité", "2", "2"}, {"capilectomie", "2", "2"}, ¬
{"causalité", "2", "2"}, {"chambre", "2", "2"}, {"champ", "1", "2"}, ¬
{"champ de force", "1", "2"}, {"coeur", "1", "2"}, {"conduit", "1", ¬
"2"}, {"configuration", "2", "2"}, {"continuum", "1", "2"}, ¬
{"convertisseur", "1", "2"}, {"corridor", "1", "2"}, {"crevasse", "2", ¬
"2"}, {"cristal", "1", "2"}, {"cybergement", "1", "2"}, {"déflecteur", ¬
"1", "2"}, {"désintégrateur", "1", "2"}, {"détonateur", "1", "2"}, ¬
{"diagnostic", "1", "2"}, {"disrupteur", "1", "2"}, {"distortion", "2", ¬
"2"}, {"écho", "1", "2"}, {"efficience", "2", "2"}, {"émission", "2", ¬
"2"}, {"endiguement", "1", "2"}, {"énergie", "2", "2"}, {"entité", "2", ¬
"2"}, {"filament", "1", "2"}, {"filtre", "1", "2"}, {"flot", "1", "2"}, ¬
{"flux", "1", "2"}, {"force", "2", "2"}, {"formation", "2", "2"}, ¬
{"fragment", "1", "2"}, {"fragmenticule", "1", "2"}, {"fréquence", "2", ¬
"2"}, {"gain", "1", "2"}, {"générateur", "1", "2"}, {"gicleur", "1", ¬
"2"}, {"glomérule", "2", "2"}, {"goniotron", "1", "2"}, {"graviton", ¬
"1", "2"}, {"grille", "2", "2"}, {"hologramme", "1", "2"}, {"impulsion", ¬
"2", "2"}, {"incursion", "2", "2"}, {"inducteur", "1", "2"}, {"inertie", ¬
"1", "2"}, {"inhibiteur", "1", "2"}, {"laplaxmol", "1", "2"}, ¬
{"matiere", "2", "2"}, {"matrice", "2", "2"}, {"mécanisme", "1", "2"}, ¬
{"mine", "2", "2"}, {"mitochondrie", "2", "2"}, {"moteur", "1", "2"}, ¬
{"moulinotron", "1", "2"}, {"multiplexeur", "1", "2"}, {"nacelle", "2", ¬
"2"}, {"noyau", "1", "2"}, {"nuage", "1", "2"}, {"ordinateur", "1", ¬
"2"}, {"papsouille", "2", "2"}, {"parallax", "1", "2"}, {"particule", ¬
"2", "2"}, {"plasma", "1", "2"}, {"plutonneur", "1", "2"}, {"porteuse", ¬
"2", "2"}, {"poussée", "2", "2"}, {"radiation", "2", "2"}, {"rayon", ¬
"1", "2"}, {"réhausseur", "1", "2"}, {"relai", "1", "2"}, {"rémouleur", ¬
"1", "2"}, {"réplicateur", "1", "2"}, {"réplication", "2", "2"}, ¬
{"réseau", "1", "2"}, {"résonnateur", "1", "2"}, {"ressort", "1", "2"}, ¬
{"rotation", "2", "2"}, {"schisme", "1", "2"}, {"séquence", "2", "2"}, ¬
{"signal", "1", "2"}, {"signature", "2", "2"}, {"singularité", "2", ¬
"2"}, {"sonde", "2", "2"}, {"spouniseur", "1", "2"}, {"survolteur", "1", ¬
"2"}, {"sustentation", "2", "2"}, {"syntagme", "1", "2"}, {"tachyon", ¬
"1", "2"}, {"transistor", "1", "2"}, {"translateur", "1", "2"}, ¬
{"transporteur", "1", "2"}, {"trigloide", "1", "2"}, {"trophoblaste", ¬
"1", "2"}, {"tropisme", "1", "2"}, {"tube", "1", "2"}, {"tunnel", "1", ¬
"2"}, {"turbulence", "1", "2"}, {"vagissement", "1", "2"}, {"vague", ¬
"2", "2"}, {"vibration", "2", "2"}, {"vide", "1", "2"}, {"vortex", "1", ¬
"2"}}

property prefix_list : {"aéro", "ana", "anti", "auto", "bi", "bulbo", ¬
"capillo", "crypto", "extra", "hepta", "hétéro", "homo", "méta", ¬
"micro", "morpho", "morvo", "multi", "néo", "non", "nucléo", "octo", ¬
"penta", "poly", "proto", "pseudo", "puslo", "quadri", "rétro", "servo", ¬
"spiro", "sub", "sur", "thermo", "theta", "trans", "tri", "turbo", ¬
"ultra"}

property gabarit_list : {"Si nous pouvons [v] [n] [a], nous devrions
pouvoir [v] [n] [a] et [v] [n] [a] !", "Capitaine, je ne peux pas [v]
[n] parce que [n] [a] est sur le point [d] [n] [a] !", "[v] [n] [a] est
illogique, puisque [n] [a] va [v] [n] [a].", "Il est possible que [n]
[a] puisse [v] [n] [a], mais seulement si nous pouvons [v] [n] [a] et
[v] [n] [a] !", "Pas de panique ! [v] [n] [a] ne nous empêche pas [d]
[n] [a] ni même [d] [n] [a].", "Voici [n] [a] dont il est temps [d] [n]
[a] sans oublier [d] [n] [a].", "Damned, [n] [a] ne peut pas [v] [n] [a]
! Nous allons être obligé [d] [n] [a]...", "Tout va bien a bord. [n] [a]
semble [v] correctement. Mais nous devrions [v] [n] [a] pour plus de
sécurité.", "Alerte ! [n] [a] semble [v] dangereusement ! Il faut [v]
[n] [a] d'urgence !!!", "Veuillez [v] [n] [a] avant [d] sciemment."}

property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"
property PUNCTS : ".!?"

--https://groups.google.com/d/msg/fr.comp.os.mac-os.x/ph6oTyTlttc/JO0jvxTC0ScJ

on substitute_Verb(prep)
set the_x to random number from 1 to the count of verbs_list
set theVerb to item 1 of item the_x of verbs_list as string
if item 2 of item the_x of verbs_list is "1" then
set theVerb to substitute_Prefix() & "-" & theVerb
else if item 2 of item the_x of verbs_list is "2" then
if alea() is 1 then set theVerb to substitute_Prefix() & "-" & theVerb
end if
if prep is 1 then
if check_Voyelle(theVerb) is true then
set theVerb to "d'" & theVerb
else
set theVerb to "de " & theVerb
end if
end if
return theVerb
end substitute_Verb

on substitute_Adj(adjGenre)
set the_x to random number from 1 to the count of adjective_list
if adjGenre = 1 then
set the_adj to item 1 of item the_x of adjective_list as string
else
set the_adj to item 2 of item the_x of adjective_list as string
end if
return the_adj
end substitute_Adj

on substitute_noun(genre, withAdj)
set the_x to random number from 1 to the count of noun_list
set the_noun to item 1 of item the_x of noun_list as string
set currGenre to item 2 of item the_x of noun_list as integer
if genre ≠ 0 and genre is not currGenre then
set the_noun to substitute_noun(genre, withAdj)
else
if item 3 of item the_x of noun_list is "1" then
set the_noun to substitute_Prefix() & "-" & the_noun
else if item 3 of item the_x of noun_list is "2" then
if alea() is 1 then set the_noun to substitute_Prefix() & "-" & the_noun
end if
if withAdj is 1 then
set the_noun to the_noun & " " & substitute_Adj(currGenre)
end if
end if
if check_Voyelle(the_noun) is true then
set the_noun to "l'" & the_noun
else if currGenre is 1 then
set the_noun to "le " & the_noun
else
set the_noun to "la " & the_noun
end if
return the_noun
end substitute_noun

on substitute_Prefix()
set the_x to random number from 1 to the count of prefix_list
return item the_x of prefix_list as string
end substitute_Prefix

on get_Gabarit()
set the_x to random number from 1 to the count of gabarit_list
return item the_x of gabarit_list as string
end get_Gabarit

on check_Voyelle(the_word)
if character 1 of the_word is in {"a", "e", "i", "o", "u", "y", "é", "h"} then
return true
else
return false
end if
end check_Voyelle

on alea()
return random number from 0 to 1
end alea

on noun_with_adj(Phrase, counter)
set cResult to 0
set counter to counter + 4
set numChars to (count characters of Phrase)
if counter < numChars - 2 and text counter thru (counter + 2) of Phrase is "[a]" then set
cResult to 1
return cResult
end noun_with_adj

on lower2Upper(theChar)
if theChar is in LC then set theChar to item (offset of theChar in LC) of UC
return theChar as string
end lower2Upper

on corvo()
set startPhrase to get_Gabarit()
set resPhrase to ""

set numChars to (count characters of startPhrase)
set x to 0 as integer
repeat while x < numChars - 2
set x to x + 1
set tempWord to text x thru (x + 2) of startPhrase
if tempWord is "[v]" then --verb
set resPhrase to resPhrase & substitute_Verb(0)
set x to x + 2
else if tempWord is "[n]" then --noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(0, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(0, 0)
set x to x + 2
end if
else if tempWord is "[a]" then --adj
set resPhrase to resPhrase & substitute_Adj(0)
set x to x + 2
else if tempWord is "[d]" then --verb with preposition
set resPhrase to resPhrase & substitute_Verb(1)
set x to x + 2
else if tempWord is "[m]" then --masc noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(1, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(1, 0)
set x to x + 2
end if
else if tempWord is "[f]" then --femin noun
if noun_with_adj(startPhrase, x) is 1 then
set resPhrase to resPhrase & substitute_noun(2, 1)
set x to x + 6
else
set resPhrase to resPhrase & substitute_noun(2, 0)
set x to x + 2
end if
else
set resPhrase to resPhrase & character x of startPhrase
end if
end repeat
set resPhrase to resPhrase & text (x + 1) thru numChars of startPhrase

set numChars to (count characters of resPhrase)
set corPhrase to lower2Upper(item 1 of resPhrase)
set corPhrase to corPhrase & item 2 of resPhrase
set x to 3 as integer

repeat while x < numChars
set theChar to item x of resPhrase
if (item (x - 2) of resPhrase) is in PUNCTS then set theChar to lower2Upper(theChar)
set corPhrase to corPhrase & theChar
set x to x + 1
end repeat
return corPhrase
end corvo

on substitute()
set result to corvo()
return result
end substitute

set the clipboard to corvo()

corvo()



tell application "TextEdit"
activate
delay 0.5
tell application "System Events"
activate
keystroke "v" using command down
keystroke return
keystroke return
set visible of process "TextEdit" to false
delay 0.5
set frontmost of process "TextEdit" to true
end tell
end tell
---------------------------------------

--
Gérard FLEUROT plus un
Avatar
someone
Une Bévue wrote:

Le 15/07/2015 17:40, Une Bévue a écrit :
> property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
> property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"

à vérifier par tous que j'ai bien utilisé toutes les lettres accentuées
utilisées en french ))



Bah et les trémas, alors ?

--
[SbM]
"If the French were really intelligent, they'd speak English" (W. Sheed)
Avatar
g4fleurot
Fleuger wrote:

retours à la ligne intempestifs



Pour la référence du fil, il faut l'écrire :

--<https://groups.google.com/d/msg/fr.comp.os.mac-os.x/ph6oTyTlttc/JO0jvxTC0ScJ>
pour qu'il ne soit pas coupé par MacSoup

--
Gérard FLEUROT plus un
Avatar
Paul Gaborit
À (at) Wed, 15 Jul 2015 18:50:38 +0200,
(SbM) écrivait (wrote):

Une Bévue wrote:

Le 15/07/2015 17:40, Une Bévue a écrit :
> property UC : "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÂÉÈÊÎÔÙÛ"
> property LC : "abcdefghijklmnopqrstuvwxyzàâéèêîôùû"

à vérifier par tous que j'ai bien utilisé toutes les lettres accentuées
utilisées en french ))



Bah et les trémas, alors ?



Ne pas oublier œ, Œ, æ, Æ... pour ne pas briser le cœur de Lætitia.

--
Paul Gaborit - <http://perso.mines-albi.fr/~gaborit/>
1 2 3 4 5