Accueil > > > PROGRAMME POUR RENOMMER PLUSIEUR FICHIER
PROGRAMME POUR RENOMMER PLUSIEUR FICHIER
Information sur la source
Description
J'ai fait ce programme pour renommer les fichiers (a l'origine les mp3). Il permet d'enlever , rajouter des caracteres a un endroit choisi dans la chaines. Le programme est quasiment fini mais mon cerveau avait besoin d'un break, donc quelques bug restent. Comme le rafraichissement auto de la liste de selection ou le message d'erreur qui n'apparait pas si "toutes les cases" n'ont pas été cochées. Je suis assez debutant donc n'hesitez pas a me critiquer ou me dire comment j'aurais pu faire mieux.Toutes les remarques seront bienvenues Tchô
Source
- Public selectedfile As String
- Public Valtextaddremo As String
- Public texttoremove As String
- Private Sub Checkadd_Click()
- 'if we clic on add, remove must come off
- If Checkadd.Value = Checked Then
- Checkremove.Value = Unchecked
- End If
- End Sub
- Private Sub Checkremove_Click()
- 'if we clic on remove, add must come off
- If Checkremove.Value = Checked Then
- Checkadd.Value = Unchecked
- End If
- End Sub
- Private Sub Checkafter_Click()
- 'if we clic on after, before must come off
- If Checkafter.Value = Checked Then
- Checkbefore.Value = Unchecked
- End If
- End Sub
- Private Sub Checkbefore_Click()
- 'if we clic on before, after must come off
- If Checkbefore.Value = Checked Then
- Checkafter.Value = Unchecked
- End If
- End Sub
- Private Sub Command1_Click()
- 'erase the textaddremove textbox
- Textaddremove.Text = ""
- End Sub
- Private Sub Command2_Click()
- 'erase the Textpos textbox
- Textpos.Text = ""
- End Sub
- Private Sub Command3_Click()
- 'copy text1 selection
- Form1.Text1.SetFocus
- SendKeys "^C"
- End Sub
- Private Sub Command4_Click()
- 'paste the selection into textaddremove textbox
- Form1.Textaddremove.SetFocus
- SendKeys "^V"
- End Sub
- Private Sub Command5_Click()
- 'paste the selection into textpos textbox
- Form1.Textpos.SetFocus
- SendKeys "^V"
- End Sub
- Private Sub Commandaddall_Click()
- 'add all the files into file1 to list1
- For i = 0 To File1.ListCount - 1
- List1.AddItem File1.List(i)
- Next
- End Sub
- Private Sub Commandaddorremove_Click()
- 'we replace (textpos) by (textpos + textaddremove)
- If Checkadd.Value And Checkbefore.Value = Checked Then
- Textposition = Textaddremove & Textpos
- Textposition2 = Textpos
- GoTo changename
- ElseIf Checkremove.Value And Checkbefore.Value = Checked Then
- Textposition = Textpos
- Textposition2 = Textaddremove & Textpos
- GoTo changename
- ElseIf Checkadd.Value And Checkafter.Value = Checked Then
- Textposition = Textpos & Textaddremove
- Textposition2 = Textpos
- GoTo changename
- ElseIf Checkremove.Value And Checkafter.Value = Checked Then
- Textposition = Textpos
- Textposition2 = Textpos & Textaddremove
- ElseIf Checkadd.Value Or Checkremove.Value Or Checkbefore.Value Or Checkafter.Value = Unchecked Then
- MsgBox "Cochez toutes les cases..."
- End If
- changename:
- For i = 0 To List1.ListCount - 1
- selectedfileC = List1.List(i)
- 'on cherche dans (selectedfileC) le (textposition2) qu'on va remplacer par (textposition), that will give us newname1010
- newname1010 = Replace(selectedfileC, Textposition2, Textposition)
- 'i use f and g as string cuz the fonction (name) wont work with such complexe expressions
- f = Dir1.Path & "\" & selectedfileC
- g = Dir1.Path & "\" & newname1010
- Name f As g
- Next
- File1.Refresh
-
-
-
-
-
- End Sub
- Private Sub Commandaddselected_Click()
- 'i copy the selection in file1 to list1
- Dim i As Integer
- If File1.ListIndex = -1 Then Exit Sub
- For i = File1.ListCount - 1 To 0 Step -1
- If File1.Selected(i) = True Then
- List1.AddItem File1.List(i)
- End If
- Next i
- End Sub
- Private Sub Commandclearlist_Click()
- List1.Clear
- End Sub
- Private Sub Commandclearselected_Click()
- 'same as copy into list1 but this is to remove a selection from a list
- Dim i As Integer
- If List1.ListIndex = -1 Then Exit Sub
- For i = List1.ListCount - 1 To 0 Step -1
- If List1.Selected(i) = True Then
- List1.RemoveItem (i)
- End If
- Next i
- End Sub
- Private Sub Commandundertospaces_Click()
- 'same as above, i search (_) into (selectedfileB) and replace it with ( )
- For i = 0 To List1.ListCount - 1
- selectedfileB = List1.List(i)
- newnameB = Replace(selectedfileB, "_", " ")
- d = Dir1.Path & "\" & selectedfileB
- e = Dir1.Path & "\" & newnameB
- Name d As e
- Next
- File1.Refresh
- End Sub
- Private Sub Drive1_Change()
- Dir1.Path = Drive1.Drive
- End Sub
- Private Sub Dir1_Change()
- File1.Path = Dir1.Path
- End Sub
- Private Sub List1_Click()
- 'i copy the name of the file i clic on into the text1box for the user to use it for copying and pasting
- Text1.Text = List1.Text
- End Sub
- Private Sub onlymp3_Click()
- 'i set file1 to show only the files.mp3 if (onlymp3) is checked, else it shows *.*
- If onlymp3.Value = 1 Then
- File1.Pattern = "*.mp3"
- Else
- File1.Pattern = "*.*"
- End If
- End Sub
- Private Sub Commandexit_Click()
- End
- End Sub
- Private Sub Textaddremove_Change()
- Textaddremove = Textaddremove.Text
- End Sub
- Private Sub Textpos_Change()
- Textpos = Textpos.Text
- End Sub
Public selectedfile As String
Public Valtextaddremo As String
Public texttoremove As String
Private Sub Checkadd_Click()
'if we clic on add, remove must come off
If Checkadd.Value = Checked Then
Checkremove.Value = Unchecked
End If
End Sub
Private Sub Checkremove_Click()
'if we clic on remove, add must come off
If Checkremove.Value = Checked Then
Checkadd.Value = Unchecked
End If
End Sub
Private Sub Checkafter_Click()
'if we clic on after, before must come off
If Checkafter.Value = Checked Then
Checkbefore.Value = Unchecked
End If
End Sub
Private Sub Checkbefore_Click()
'if we clic on before, after must come off
If Checkbefore.Value = Checked Then
Checkafter.Value = Unchecked
End If
End Sub
Private Sub Command1_Click()
'erase the textaddremove textbox
Textaddremove.Text = ""
End Sub
Private Sub Command2_Click()
'erase the Textpos textbox
Textpos.Text = ""
End Sub
Private Sub Command3_Click()
'copy text1 selection
Form1.Text1.SetFocus
SendKeys "^C"
End Sub
Private Sub Command4_Click()
'paste the selection into textaddremove textbox
Form1.Textaddremove.SetFocus
SendKeys "^V"
End Sub
Private Sub Command5_Click()
'paste the selection into textpos textbox
Form1.Textpos.SetFocus
SendKeys "^V"
End Sub
Private Sub Commandaddall_Click()
'add all the files into file1 to list1
For i = 0 To File1.ListCount - 1
List1.AddItem File1.List(i)
Next
End Sub
Private Sub Commandaddorremove_Click()
'we replace (textpos) by (textpos + textaddremove)
If Checkadd.Value And Checkbefore.Value = Checked Then
Textposition = Textaddremove & Textpos
Textposition2 = Textpos
GoTo changename
ElseIf Checkremove.Value And Checkbefore.Value = Checked Then
Textposition = Textpos
Textposition2 = Textaddremove & Textpos
GoTo changename
ElseIf Checkadd.Value And Checkafter.Value = Checked Then
Textposition = Textpos & Textaddremove
Textposition2 = Textpos
GoTo changename
ElseIf Checkremove.Value And Checkafter.Value = Checked Then
Textposition = Textpos
Textposition2 = Textpos & Textaddremove
ElseIf Checkadd.Value Or Checkremove.Value Or Checkbefore.Value Or Checkafter.Value = Unchecked Then
MsgBox "Cochez toutes les cases..."
End If
changename:
For i = 0 To List1.ListCount - 1
selectedfileC = List1.List(i)
'on cherche dans (selectedfileC) le (textposition2) qu'on va remplacer par (textposition), that will give us newname1010
newname1010 = Replace(selectedfileC, Textposition2, Textposition)
'i use f and g as string cuz the fonction (name) wont work with such complexe expressions
f = Dir1.Path & "\" & selectedfileC
g = Dir1.Path & "\" & newname1010
Name f As g
Next
File1.Refresh
End Sub
Private Sub Commandaddselected_Click()
'i copy the selection in file1 to list1
Dim i As Integer
If File1.ListIndex = -1 Then Exit Sub
For i = File1.ListCount - 1 To 0 Step -1
If File1.Selected(i) = True Then
List1.AddItem File1.List(i)
End If
Next i
End Sub
Private Sub Commandclearlist_Click()
List1.Clear
End Sub
Private Sub Commandclearselected_Click()
'same as copy into list1 but this is to remove a selection from a list
Dim i As Integer
If List1.ListIndex = -1 Then Exit Sub
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) = True Then
List1.RemoveItem (i)
End If
Next i
End Sub
Private Sub Commandundertospaces_Click()
'same as above, i search (_) into (selectedfileB) and replace it with ( )
For i = 0 To List1.ListCount - 1
selectedfileB = List1.List(i)
newnameB = Replace(selectedfileB, "_", " ")
d = Dir1.Path & "\" & selectedfileB
e = Dir1.Path & "\" & newnameB
Name d As e
Next
File1.Refresh
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub List1_Click()
'i copy the name of the file i clic on into the text1box for the user to use it for copying and pasting
Text1.Text = List1.Text
End Sub
Private Sub onlymp3_Click()
'i set file1 to show only the files.mp3 if (onlymp3) is checked, else it shows *.*
If onlymp3.Value = 1 Then
File1.Pattern = "*.mp3"
Else
File1.Pattern = "*.*"
End If
End Sub
Private Sub Commandexit_Click()
End
End Sub
Private Sub Textaddremove_Change()
Textaddremove = Textaddremove.Text
End Sub
Private Sub Textpos_Change()
Textpos = Textpos.Text
End Sub
Historique
- 01 janvier 2008 15:10:41 :
- voici le .zip
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Renommer des dossiers à la chaine avec des contraintes... [ par SamyVW ]
Oups, je n'avais pas vu qu'il y avait un forum spécialement prévu pour ma question... Je la repose donc ici, tout en m'excusant de laisser l'autre à s
Remplacer dans une chaine de caractères à partir de la fin [ par daddyel ]
Bonjour,Je souhaite dans une requête de mise à jour effectuer un "replace" en partant de la fin du champ (champ de longueur variable).Ainsi
preg_replace pour chaine de code php [ par JoJo738 ]
Bonjour, je fait un petit code php pour ameliorer le code php ( et surtout pour ne plus me faire gronger par Anthomicro ). Je viens juste de le sommen
preg_replace pour chaine de code php [ par JoJo738 ]
preg_replace pour chaine de code php [ par JoJo738 ]
Renommer fichier dans un filelistbox ou autres sous VB6 [ par micmond ]
Bonjour,J'ai Visual Basic 6.01. Renommer un fichier sous l'application Visual Basic J'ai une filelistbox qui affiche une liste de fichiers d'une direc
Faire un Replace sur une RichTextBox [ par lokomass ]
Bonjour, J'aimerai automatiquement, qu'à chaque fois qu'une chaine de caractère apparait dans ma RTBox, elle soit remplacée par une autre. Comme ma R
Pb creation fonction remplacement de texte [ par kciope ]
Bonjour tout le monde,je souhaite créer une fonction qui remplace certains caractère d'une chaine, voici ma fonction : Public Function modif_titre
preg_replace pour code php [ par JoJo738 ]
Bonjour, je fait un petit code php pour ameliorer le code php ( et surtout pour ne plus me faire gronger par Anthomicro ). Je viens juste de le somme
HS : Comment enregistrer par l'entrée audio ? [ par loic38760 ]
J'ai une chaine Hi-Fi, j'e l'ai relié à l'aide d'un cable à l'entrée audio de la carte son mon ordinateur (prise bleue) mais
|
Derniers Blogs
PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS !PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS ! par Etienne Margraff
J'ai récemment eu un problème pour obtenir l'intelliTrace sur un site web dans IIS. Il n'y avait pas de message d'erreur, rien dans le journal d'évènement Windows, et après 3 appels à une voyante, 2 visites chez un marabou, j'ai failli me résign...
Cliquez pour lire la suite de l'article par Etienne Margraff OFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONSOFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONS par junarnoalg
De nombreuses entreprises font le choix de SharePoint Online, service fourni au travers de l'offre de Microsoft Office 365. S'il est vrai que ce choix apporte un grand nombre d'avantages; rapidité de mise en œuvre, disponibilité, large couvertu...
Cliquez pour lire la suite de l'article par junarnoalg PRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGEPRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGE par richardc
http://www.c2idotnet.com/articles/presentation-des-api-rest-de-windows-azure-lister-les-comptes-de-storage
Désolé pour "toto", mais c2i existait avant blogs.developpeur.org et c'est mon site "officiel" ;-) ...
Cliquez pour lire la suite de l'article par richardc [HTML5] SLIDES ET DéMOS : AUTOUR DU W3C , NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] SLIDES ET DéMOS : AUTOUR DU W3C , NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Très bonne après-midi passée lors cette conférence avec le W3C, organisée par L' Inria sur les nouveaux standards, ce Mardi 14 Février, on sent vraiment que çà bosse au W3C, et l'avenir est très très prometteur pour le HTML5, notamment ...
Cliquez pour lire la suite de l'article par Gio
Forum
FONCTION EXCEL VBAFONCTION EXCEL VBA par samanta26
Cliquez pour lire la suite par samanta26
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|