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
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
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
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
L'INTERFACE NATURELLE DE WINDOWS PHONE 7 SERIESL'INTERFACE NATURELLE DE WINDOWS PHONE 7 SERIES par odewit
La tendance est aux interfaces naturelles (NUI), et le keynote de Bill Buxton au MIX l'a bien souligné.
La charte graphique et ergonomique de Windows Phone 7 a donc été entièrement repensée en vue d'obtenir un maximum d'efficacité sur ce point. En re...
Cliquez pour lire la suite de l'article par odewit COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE?COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE? par Matthieu MEZIL
Avec EF, les vues doivent être mappées sur des entity types. Le problème c'est que les entity types doivent avoir une clé. Avec EF, nous avons les complex type qui n'ont pas de clé mais les vues ne peuvent pas être mappées dessus. Avec EF4, il est possibl...
Cliquez pour lire la suite de l'article par Matthieu MEZIL [WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL?[WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL? par JeremyJeanson
Certain d'entre vous on peut être vécu cette situation embarrassante après quelques temps passer avec WF4 : Au début avec mon " ActivityDesigner" , tout allait bien. Et puis un jour j'ai au des problèmes de " Binding" . Alors nous sommes allé sur le site ...
Cliquez pour lire la suite de l'article par JeremyJeanson
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|