Déplacer des fichiers automatiquement

essai cette version qui attend tant que le fichier est = à 0

Bloc de code:
property FVideo : {"dv", "DV", "mov", "MOV", "VOB", "vob", "divx", "mp4", "MP4", "avi", "AVI", "MKV", "mkv"}
property DVideo : "mes_Videos"

on adding folder items to Mon_Dossier after receiving Liste_Fichiers
    tell application "Finder"
        
        set Dossiers_Ajout to {DVideo}
        
        repeat with Mon_Item in Liste_Fichiers
            set Mon_Ext to name extension of Mon_Item
            set Mon_Nom to name of Mon_Item
            if Mon_Ext is "download" then
                set Mon_Temp to text 1 thru ((length of Mon_Nom) - 9) of Mon_Nom
                set I to length of Mon_Temp
                repeat while character I of Mon_Temp is not "."
                    set I to I - 1
                end repeat
                set Mon_Ext to text (I + 1) thru (length of Mon_Temp) of Mon_Temp
                set Mon_Nom to text 1 thru I of Mon_Temp
            end if
            
            try
                set Mon_Fichier to Mon_Item as alias
                set OldSize to -1
                repeat until (size of Mon_Fichier) = OldSize
                    set OldSize to (size of Mon_Fichier)
                    if OldSize = 0 then OldSize = -1
                    delay 0.5
                end repeat
            end try
            
            if Mon_Ext is in FVideo then
                tell application "Finder"
                    set lefichier to Mon_Item as string
                    
                    set infoRec to info for file lefichier --recup taille
                    set lataille to size of infoRec
                    set duree to do shell script "/usr/local/bin/exiftool -Duration " & quoted form of POSIX path of lefichier --récupère la durée au format texte exiftool
                    set AppleScript's text item delimiters to {":"} --defini le séparateur
                    set NB to count of text items of duree -- verifie si duree est inférieur à 30 secondes (notation différente)
                    if NB = 2 then --recup duree en secondes
                        set lesseconde to text item 2 of duree
                        set AppleScript's text item delimiters to {"."}
                        set seconde to text item 1 of lesseconde
                        set AppleScript's text item delimiters to {""}
                    else -- recup duree si supérieure à 30 sec (format hh : mn : sec )
                        set AppleScript's text item delimiters to {":"}
                        set seconde to get last text item of duree as string -- récupère les secondes
                        set minute to text item 3 of duree as string -- récupère les minutes
                        set heure to text item 2 of duree as string --récupère les heures
                        set seconde to seconde + (minute * 60) + (heure * 3600)
                        set AppleScript's text item delimiters to {""}
                    end if
                    
                end tell
                
                if seconde > 4500 then
                    set dossier_videos to ((path to home folder) & "Documents:Vidéos:Finals:") as string
                    move Mon_Item to folder dossier_videos as alias
                else
                    if lataille > 500000000 then
                        set dossier_videos to ((path to home folder) & "Documents:Vidéos:Rushs:") as string
                        move Mon_Item to folder dossier_videos as alias
                    end if
                end if
                
                
            end if
        end repeat
        
    end tell
end adding folder items to
 
Je ne comprends pas, ça ne fonctionne pas... Il faut que je fasse une action sur le fichier pour qu'il soit déplacé.

Voici ce que j'ai dans mon script, nous sommes d'accord, j'ai bien tout copié/collé ? :D

Bloc de code:
property FVideo : {"dv", "DV", "mov", "MOV", "VOB", "vob", "divx", "mp4", "MP4", "avi", "AVI", "MKV", "mkv"}
property DVideo : "mes_Videos"

on adding folder items to Mon_Dossier after receiving Liste_Fichiers
    tell application "Finder"
        
        set Dossiers_Ajout to {DVideo}
        
        repeat with Mon_Item in Liste_Fichiers
            set Mon_Ext to name extension of Mon_Item
            set Mon_Nom to name of Mon_Item
            if Mon_Ext is "download" then
                set Mon_Temp to text 1 thru ((length of Mon_Nom) - 9) of Mon_Nom
                set I to length of Mon_Temp
                repeat while character I of Mon_Temp is not "."
                    set I to I - 1
                end repeat
                set Mon_Ext to text (I + 1) thru (length of Mon_Temp) of Mon_Temp
                set Mon_Nom to text 1 thru I of Mon_Temp
            end if
            
            try
                set Mon_Fichier to Mon_Item as alias
                set OldSize to -1
                repeat until (size of Mon_Fichier) = OldSize
                    set OldSize to (size of Mon_Fichier)
                    if OldSize = 0 then OldSize = -1
                    delay 0.5
                end repeat
            end try
            
            if Mon_Ext is in FVideo then
                tell application "Finder"
                    set lefichier to Mon_Item as string
                    
                    set infoRec to info for file lefichier --recup taille
                    set lataille to size of infoRec
                    set duree to do shell script "/usr/local/bin/exiftool -Duration " & quoted form of POSIX path of lefichier --récupère la durée au format texte exiftool
                    set AppleScript's text item delimiters to {":"} --defini le séparateur
                    set NB to count of text items of duree -- verifie si duree est inférieur à 30 secondes (notation différente)
                    if NB = 2 then --recup duree en secondes
                        set lesseconde to text item 2 of duree
                        set AppleScript's text item delimiters to {"."}
                        set seconde to text item 1 of lesseconde
                        set AppleScript's text item delimiters to {""}
                    else -- recup duree si supérieure à 30 sec (format hh : mn : sec )
                        set AppleScript's text item delimiters to {":"}
                        set seconde to get last text item of duree as string -- récupère les secondes
                        set minute to text item 3 of duree as string -- récupère les minutes
                        set heure to text item 2 of duree as string --récupère les heures
                        set seconde to seconde + (minute * 60) + (heure * 3600)
                        set AppleScript's text item delimiters to {""}
                    end if
                    
                end tell
                
                if seconde > 4500 then
                    set dossier_videos to ((path to home folder) & "Documents:Vidéos:Finals:") as string
                    move Mon_Item to folder dossier_videos as alias
                else
                    if lataille > 500000000 then
                        set dossier_videos to ((path to home folder) & "Documents:Vidéos:Rushs:") as string
                        move Mon_Item to folder dossier_videos as alias
                    end if
                end if
                
                
            end if
        end repeat
        
    end tell
end adding folder items to
 
Comme je t'ai dis , je ne peux pas tester, chez moi ça fonctionne.
Teste celui la:


Bloc de code:
property FVideo : {"dv", "DV", "mov", "MOV", "VOB", "vob", "divx", "mp4", "MP4", "avi", "AVI", "MKV", "mkv"}
property DVideo : "mes_Videos"

on adding folder items to Mon_Dossier after receiving Liste_Fichiers
    tell application "Finder"
        
        set Dossiers_Ajout to {DVideo}
        
        repeat with Mon_Item in Liste_Fichiers
            set Mon_Ext to name extension of Mon_Item
            set Mon_Nom to name of Mon_Item
            if Mon_Ext is "download" then
                set Mon_Temp to text 1 thru ((length of Mon_Nom) - 9) of Mon_Nom
                set I to length of Mon_Temp
                repeat while character I of Mon_Temp is not "."
                    set I to I - 1
                end repeat
                set Mon_Ext to text (I + 1) thru (length of Mon_Temp) of Mon_Temp
                set Mon_Nom to text 1 thru I of Mon_Temp
            end if
            
            try
                set Mon_Fichier to Mon_Item as alias
                set OldSize to -1
                repeat until (size of Mon_Fichier) = OldSize
                    set OldSize to (size of Mon_Fichier)
                    if OldSize = 0 then set OldSize to -1
                    delay 0.5
                end repeat
            end try
            
            if Mon_Ext is in FVideo then
                tell application "Finder"
                    set lefichier to Mon_Item as string
                    
                    set infoRec to info for file lefichier --recup taille
                    set lataille to size of infoRec
                    set duree to do shell script "/usr/local/bin/exiftool -Duration " & quoted form of POSIX path of lefichier --récupère la durée au format texte exiftool
                    set AppleScript's text item delimiters to {":"} --defini le séparateur
                    set NB to count of text items of duree -- verifie si duree est inférieur à 30 secondes (notation différente)
                    if NB = 2 then --recup duree en secondes
                        set lesseconde to text item 2 of duree
                        set AppleScript's text item delimiters to {"."}
                        set seconde to text item 1 of lesseconde
                        set AppleScript's text item delimiters to {""}
                    else -- recup duree si supérieure à 30 sec (format hh : mn : sec )
                        set AppleScript's text item delimiters to {":"}
                        set seconde to get last text item of duree as string -- récupère les secondes
                        set minute to text item 3 of duree as string -- récupère les minutes
                        set heure to text item 2 of duree as string --récupère les heures
                        set seconde to seconde + (minute * 60) + (heure * 3600)
                        set AppleScript's text item delimiters to {""}
                    end if
                    
                end tell
                
                if seconde > 4500 then
                    set dossier_videos to ((path to home folder) & "Documents:Vidéos:Finals:") as string
                    move Mon_Item to folder dossier_videos as alias
                else
                    if lataille > 500000000 then
                        set dossier_videos to ((path to home folder) & "Documents:Vidéos:Rushs:") as string
                        move Mon_Item to folder dossier_videos as alias
                    end if
                end if
                
                
            end if
        end repeat
        
    end tell
end adding folder items to
 
C'est bon ! Cela fonctionne maintenant !

Qu'avez vous changé par rapport à l'ancien script ?

En tout cas merci beaucoup, ça me sauve !
 
Le script surveille tout les 0.5 seconde si la taille du fichier change, Si la taille ne change pas il considère que le chargement est terminé et déplace ce fichier.
Hors lors du transfert le fichier est créé avec taille 0 et le reste jusqu'a la fin. j'ai donc ajouté dans le script que tant que la taille est 0, il recommence la surveillance.
c'est la partie là:

Bloc de code:
repeat until (size of Mon_Fichier) = OldSize
                    set OldSize to (size of Mon_Fichier)
                    if OldSize = 0 then set OldSize to -1
                    delay 0.5
                end repeat

Bref si tout fonctionne ...
Content pour toi