Copier un fichier sur le bureau

billboc

Membre expert
Club iGen
7 Février 2000
1 786
24
entre <head> et </body>
Bonjour

J'utilise ce script (via action des dossier) pour modifier la version pdf des fichiers qui sont ajoutés à un dossier

AppleScript:
on adding folder items to this_folder after receiving these_items
    repeat with i in these_items
        if (i as string) ends with ".pdf" then
            do shell script "/usr/bin/perl -i -pe 's/%PDF-1.3/%PDF-1.4/ if 1 .. 1;' " & quoted form of POSIX path of i
        end if
    end repeat
end adding folder items to

Je cherche également à copier ensuite le fichier pdf ainsi modifié sur le bureau, pourriez vous m'aider je ne maitrise pas ce langage ?

Merci et bonne journée
 
Bonjour,

Quand tu parles de copier, tu veux dupliquer ou déplacer le fichier sur le bureau?
je te met le script modifié pour dupliquer le fichier.
Pour le déplacer tu remplaces : duplicate par move.

Bloc de code:
on adding folder items to this_folder after receiving these_items
    repeat with i in these_items
        if (i as string) ends with ".pdf" then
            do shell script "/usr/bin/perl -i -pe 's/%PDF-1.3/%PDF-1.4/ if 1 .. 1;' " & quoted form of POSIX path of i
            set lefichier to i as string
            set monbureau to path to desktop folder as string
            tell application "Finder"
                duplicate lefichier to monbureau
            end tell
        end if
    end repeat
end adding folder items to
 
  • J’aime
Réactions: pouppinou et billboc