wilfriedp
Messages postés12Date d'inscriptionvendredi 12 juin 2015StatutMembreDernière intervention20 juin 2015
-
20 juin 2015 à 14:13
vb95
Messages postés3463Date d'inscriptionsamedi 11 janvier 2014StatutContributeurDernière intervention 1 mars 2024
-
20 juin 2015 à 18:02
Bonjour,
J'ai actuellement un private qui permet de rechercher dans un fichier texte des mots définie et les retourne sur une console, jusqu'à là, rien de bien méchant :
Private Sub Syncro() Dim Findstring = IO.File.ReadAllText(My.Computer.FileSystem.CurrentDirectory & "\Path.txt") Dim Lookfor(4) As String Lookfor(0) = "SciTE" Lookfor(1) = "Battle.net" Lookfor(2) = "CCleaner" Lookfor(3) = "FileZilla" Lookfor(4) = "Gyazo"
Win32.AllocConsole() Dim sr As StreamReader = New StreamReader(My.Computer.FileSystem.CurrentDirectory & "\Path.txt") For Each line As String In File.ReadLines(My.Computer.FileSystem.CurrentDirectory & "\Path.txt") For Each s In Lookfor If line.Contains(s) Then Console.WriteLine(line) End If Next Next End Sub
Maintenant le truc, c'est que j'aimerai utilisé lookfor dans un autre sub comme ceci :
Case "Lancer CCleaner" Shell(lookfor(2))
Je pourrais tout simplement c/c mon tableau dans le sub, mais c'est pas du tout optimisé.
wilfriedp
Messages postés12Date d'inscriptionvendredi 12 juin 2015StatutMembreDernière intervention20 juin 2015 20 juin 2015 à 14:20
Hep ! J'ai déjà trouvé une autre solution, comme ceci par exemple :
Case "Lancer CCleaner" For Each line As String In File.ReadLines(My.Computer.FileSystem.CurrentDirectory & "\Path.txt") If line.Contains("CCleaner") Then Shell(line) End If Next
Mais j'aimerai savoir pour l'autre solution si cela aurait été possible ;)