IPB     Il futuro di Tevac dipende da te!  

Benvenuto Visitatore ( Log In | Registrati )

  · · · · · · · · · · · ·
Reply to this topicStart new topic
> Rinominare "n" files con AppleScript., Solo una parte del nome.
[Daitarn]
messaggio 16 Nov 2007, 09:45
Messaggio #1


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



La situazione è questa.

Nella libreria di iTunes ho alcune canzoni così nominate:

01 Titolo.mp3

Altre:

01 Titolo 1.mp3

E' possibile, e se sì come, creare un droplet che mi processi la libreria eliminando la parte " 1" che è del tutto superflua?

Grazie.


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post
Luca Dentis
messaggio 16 Nov 2007, 13:32
Messaggio #2


S.A.Y.K.
******

Gruppo: Supporter
Messaggi: 1.467
Iscritto il: 22-August 07
Da: /008/055
Utente Nr.: 8.622



prova con questo:
CITAZIONE
on run
     set this_folder to path to selection as string
end run

on open {this_folder}
     tell application "System Events" to set these_files to every file of folder this_folder
     set search_string to " 1"
     set replacement_string to ""
     repeat with i from 1 to the count of these_files
          set this_file to (item i of these_files as alias)
          set this_info to info for this_file
          if visible of this_info is true and alias of this_info is false then
               set this_text to name of this_info as string
               set new_name to replace_chars(this_text, search_string, replacement_string)
               set name of this_info to new_name
          end if
     end repeat
end open

on replace_chars(this_text, search_string, replacement_string)
     set AppleScript's text item delimiters to the search_string
     set the item_list to every text item of this_text
     set AppleScript's text item delimiters to the replacement_string
     set this_text to the item_list as string
     set AppleScript's text item delimiters to ""
     return this_text
end replace_chars
dovrebbe funzionare.
NB: devi trascinare sul droplet la cartella contenente i files da rinominare; eventuali files contenuti in sottocartelle vanno processati separatamente, trascinando la relativa sottocartella sul droplet.

-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]


--------------------
Share All Your Knowledge

A guy's dream
Go to the top of the page
 
+Quote Post
Luca Dentis
messaggio 16 Nov 2007, 16:33
Messaggio #3


S.A.Y.K.
******

Gruppo: Supporter
Messaggi: 1.467
Iscritto il: 22-August 07
Da: /008/055
Utente Nr.: 8.622



ERRATA CORRIGE:
la variabile search_string va inizializzata a " 1.mp3"
la variabile replacement_string va inizializzata a ".mp3"
Pertanto il codice corretto è questo:
CITAZIONE
on run
     set this_folder to path to selection as string
end run

on open {this_folder}
     tell application "System Events" to set these_files to every file of folder this_folder
     set search_string to " 1.mp3"
     set replacement_string to ".mp3"
     repeat with i from 1 to the count of these_files
          set this_file to (item i of these_files as alias)
          set this_info to info for this_file
          if visible of this_info is true and alias of this_info is false then
               set this_text to name of this_info as string
               set new_name to replace_chars(this_text, search_string, replacement_string)
               set name of this_info to new_name
          end if
     end repeat
end open

on replace_chars(this_text, search_string, replacement_string)
     set AppleScript's text item delimiters to the search_string
     set the item_list to every text item of this_text
     set AppleScript's text item delimiters to the replacement_string
     set this_text to the item_list as string
     set AppleScript's text item delimiters to ""
     return this_text
end replace_chars
dovrebbe funzionare.
NB: devi trascinare sul droplet la cartella contenente i files da rinominare; eventuali files contenuti in sottocartelle vanno processati separatamente, trascinando la relativa sottocartella sul droplet.

-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]


--------------------
Share All Your Knowledge

A guy's dream
Go to the top of the page
 
+Quote Post
poweruser
messaggio 17 Nov 2007, 19:20
Messaggio #4


MacInATopic
Gruppo icone

Gruppo: Team Moderatori
Messaggi: 24.319
Iscritto il: 27-July 03
Da: Maglie (LE)
Utente Nr.: 440



Hai provato semplicemente a consolidare la libreria?

Ciao
Paolo


--------------------
Paolo Portaluri

guru, n: A computer owner who can read the manual.
Go to the top of the page
 
+Quote Post
[Daitarn]
messaggio 19 Nov 2007, 09:54
Messaggio #5


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



CITAZIONE(Luca Dentis @ 16 Nov 2007, 16:33) *
eventuali files contenuti in sottocartelle vanno processati separatamente, trascinando la relativa sottocartella sul droplet.


Tieni presente che la struttura della libreria di iTunes (uso ancora la 6.0.5) è così fatta:

Cartella iTunes Library
Cartella Cantante
Cartella Album
Canzoni

Con il tuo script dovrei aprire ogni singola "Cartella Album" e processarla. Non c'è la possibilità di trascinare la cartella "iTunes Library" sul droplet così da fargli fare tutto senza aprire ogni singala sottocartella?


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post
[Daitarn]
messaggio 19 Nov 2007, 09:55
Messaggio #6


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



CITAZIONE(poweruser @ 17 Nov 2007, 19:20) *
Hai provato semplicemente a consolidare la libreria?

Ciao
Paolo


Scusa ma non funziona solo per portare nella libraria i file che sono al di fuori? Io ho tutti i miei file musicali già all'interno... Cmq no, non ho provato.


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post
poweruser
messaggio 21 Nov 2007, 21:26
Messaggio #7


MacInATopic
Gruppo icone

Gruppo: Team Moderatori
Messaggi: 24.319
Iscritto il: 27-July 03
Da: Maglie (LE)
Utente Nr.: 440



Se non sbaglio dovrebbe anche correggere i nomi dei file, ma non ho provato neanch'io.

Ciao
Paolo


--------------------
Paolo Portaluri

guru, n: A computer owner who can read the manual.
Go to the top of the page
 
+Quote Post
[Daitarn]
messaggio 28 Nov 2007, 09:11
Messaggio #8


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



CITAZIONE(poweruser @ 21 Nov 2007, 21:26) *
Se non sbaglio dovrebbe anche correggere i nomi dei file, ma non ho provato neanch'io.

Ciao
Paolo


Ho provato ma così non funziona.


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post
[Daitarn]
messaggio 30 Apr 2008, 14:33
Messaggio #9


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



Riusumo questo post... E' arrivato il momento di impegnarmi seriamente.

Rifaccio la domanda postata tempo fa.

E' possibile far processare anche le sottocartelle?


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post
chebfarid
messaggio 30 Apr 2008, 15:32
Messaggio #10


Level 8/11
********

Gruppo: Team Moderatori
Messaggi: 3.791
Iscritto il: 11-July 03
Da: Milano
Utente Nr.: 395



CITAZIONE([Daitarn] @ 30 Apr 2008, 15:33) *
E' possibile far processare anche le sottocartelle?

Forse ti è di aiuto questa discussione.

Ciao
Farid


--------------------
Abends lustig, morgens triste
das ist Leben von Artiste
Go to the top of the page
 
+Quote Post
[Daitarn]
messaggio 28 May 2008, 11:20
Messaggio #11


Level 7/11
*******

Gruppo: Forum User +
Messaggi: 2.769
Iscritto il: 9-September 04
Da: Parma
Utente Nr.: 2.307



Soluzione trovata e molto molto elegante... Basta togliere la spunta dalle preferenze di iTunes alla voce che permette di mantenere ordinata la libreria secondo i Tag dei files musicali e successivante rimatterla. Quando si rimette iTune controlla i nomi dei files ed automaticamente corregge laddove ci sono delle incongruenze per cui anche per quanto riguarda 1 di troppo.


--------------------
Va bene non saper far niente, ma niente di tutto no!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 

Collapse

> 

    Titolo discussione Risposte Autore discussione Visite Ultima azione
No new   41 sem® 3.858 Oggi, 11:29
Ultimo messaggio di: kop
No New Posts   0 casteddaia 45 2 December 2008 - 11:45
Ultimo messaggio di: casteddaia
No new   23 1ASTOR1 2astor2 330 2 December 2008 - 00:27
Ultimo messaggio di: cristianof
No new   32 Biba 1.216 1 December 2008 - 16:43
Ultimo messaggio di: Biba
No New Posts   5 Tevac 1.229 1 December 2008 - 15:35
Ultimo messaggio di: murpy
No new   9 gioco20 125 1 December 2008 - 10:12
Ultimo messaggio di: gioco20
No New Posts   4 iLudovico 59 1 December 2008 - 07:19
Ultimo messaggio di: MacIavelli
No new   22 gerod 240 28 November 2008 - 14:14
Ultimo messaggio di: gerod
No new   10 Mad_Biker 118 27 November 2008 - 23:31
Ultimo messaggio di: darma
No New Posts   0 Tevac Staff 97 25 November 2008 - 10:35
Ultimo messaggio di: