Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.sys.mac.programmation > #1427

Re: [AS] Coup de pouce

Newsgroups fr.comp.sys.mac.programmation
Subject Re: [AS] Coup de pouce
From benoit@com.invalid (Benoit)
Date 2016-05-21 16:18 +0200
Message-ID <1mnlvk0.41jzk568n4b3N%benoit@com.invalid> (permalink)
References (12 earlier) <1mnkc97.1bksq2i1x5t8hdN%benoit@com.invalid> <1mnkmpc.12afse5q737wyN%josephb@nowhere.invalid> <1mnlm7e.1jqwmkiuat23mN%benoit@com.invalid> <1mnlp17.d6jm615wqam2N%josephb@nowhere.invalid> <1mnlsjd.veuw1gvcirbaN%benoit@com.invalid>
Organization Guest of ProXad - France

Show all headers | View raw


Benoit <benoit@com.invalid> wrote:

> Joseph-B <josephb@nowhere.invalid> wrote:
> 
> > Bonjor Benoit
> > 
> > Benoit <benoit@com.invalid> a écrit,
> > 
> > > Et pourtant... il y en a qui en ont (ça serait trop simple) :
> > > accouffler (s'-).html
> > 
> > Bonne nouvelle pour toi : même les caractères incompatibles avec les
> > commandes Shell (guillemets simple ou doubles, apostrophe, parenthèses,
> > crochets, signe moins, etc.) ne gêneront pas avec ce script :
> > dans cette mouture j'ai fait en sorte que l'option "quoted form of"
> > porte sur le nom ENTIER de l'original ou du résultat.
> > Dans la version précédente ça ne portait que sur le chemin du dossier,
> > sans inclure le nom du fichier lui-même.
> > 
> > Donc un fichier ayant pour nom 
> > /accouffler (s'-).html/ va bien se convertir en un
> > /accouffler (s'-).txt/
> > (je viens de le vérifier)
> > 
> > > Merci pour tout.
> > Ce fut un plaisir ;-)
> 
> Bon, marche pô
> 
> error "Erreur dans Finder : Délai dépassé pour un AppleEvent." number
> -1712
> 
> set AllFiles to name of (every file of (HFSPath as alias) whose kind is
> "Document HTML")
> 
> Ne sait pas gérer un dossier de 50 000 fichiers. Soit je fais un « set
> appelevent timeout to 3600 » (une heure de mémoire), soit je le fais par
> morceaux dans des sous-dossiers.
> 
> J'essaye la première version en remettant un set appleevent timeout to
> je ne sais quoi (60 par exemple) juste après que la liste ait été créée.
> 
> À toute à l'heure. Je vais faire les courses pendant ce temps-là ;)

Bon, comme j'ai pas trop envie de faire les courses j'ai lancé un truc
qui marche et fortement basé sur ton code :

********************************
set pathToConvert to "/Users/benoit/Desktop/   Ze
book/Argot/www.languefrancaise.net/" --dossier source

set pathToTxt to "/Users/benoit/Desktop/   Ze
book/Argot/www.languefrancaise.net convertis/" --dossier destination

set HFSPath to (POSIX file pathToConvert) as string

tell application "Finder"   
    with timeout of 3600 seconds
        set AllFiles to name of every file of (HFSPath as alias)
    end timeout
end tell

if AllFiles = {} then
    display alert "Pas de fichier à convertir."
    return
end if

repeat with i from 1 to count AllFiles

    set htmlName to item i of AllFiles
    set txtName to ((text 1 thru -6 of htmlName) & ".txt")
    set myHtmlFile to (pathToConvert & htmlName) --nom complet du
fichier htlm à convertir
    set myTxtFile to (pathToTxt & txtName) --nom complet du fichier
converti
    do shell script ("textutil -convert txt -output " & quoted form of
myTxtFile & " " & quoted form of myHtmlFile)
    delay 0.3

end repeat
********************************

Il y en a pour pas loin d'une heure, alors je vais enfin faire les
courses ;)


-- 
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La
pratique, c'est quand tout fonctionne et que personne ne sait pourquoi.
Ici, nous avons réuni théorie et pratique : Rien ne fonctionne... et
personne ne sait pourquoi !" [ Albert Einstein ]

Back to fr.comp.sys.mac.programmation | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-15 23:15 +0200
  Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 01:51 +0200
    Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 11:48 +0200
  Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 10:10 +0200
    Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 11:48 +0200
      Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 12:14 +0200
        Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 12:36 +0200
          Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 13:24 +0200
            Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 17:10 +0200
              Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 18:19 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 20:33 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-16 21:56 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-16 23:55 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-17 20:01 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-17 21:31 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-20 19:53 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-20 23:55 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-21 12:29 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-21 13:30 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-21 15:09 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-21 15:33 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-21 16:18 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-21 17:50 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-21 18:13 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-21 22:18 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-21 23:56 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-22 00:07 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-22 01:06 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-22 11:02 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-22 17:07 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-22 01:09 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-22 02:13 +0200
                [BUG] Recherche de fichiers [FUT] Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-05-22 11:02 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-05-22 19:29 +0200
                Re: [AS] Coup de pouce blanc@empty.org (JiPaul) - 2016-06-30 11:21 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-06-30 21:06 +0200
                Re: [AS] Coup de pouce josephb@nowhere.invalid (Joseph-B) - 2016-06-30 23:29 +0200
                Re: [AS] Coup de pouce Jean-Pierre Kuypers <Kuypers@address.invalid> - 2016-07-01 10:38 +0200
                Re: [AS] Coup de pouce benoit@com.invalid (Benoit) - 2016-07-01 18:35 +0200
                Re: [AS] Coup de pouce blanc@empty.org (JiPaul) - 2016-07-17 17:42 +0200
        Correction de Script {[AS] Coup de pouce} josephb@nowhere.invalid (Joseph-B) - 2016-05-16 14:16 +0200

csiph-web