1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
|
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Inherits System.Windows.Forms.Form
Dim pv1 As Integer
Dim pv2 As Integer
Dim indicenom1 As Integer
Dim copytext1 As String
Dim nomfichier1 As String
Dim pathstockwav1 As String
Dim monprocess1 As New Process
Dim monprocess2 As New Process
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE*: la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents OpenFileDialog2 As System.Windows.Forms.OpenFileDialog
Friend WithEvents FolderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label5 = New System.Windows.Forms.Label
Me.Button5 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label4 = New System.Windows.Forms.Label
Me.Button3 = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
Me.Button2 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.OpenFileDialog2 = New System.Windows.Forms.OpenFileDialog
Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog
Me.SuspendLayout()
'
'Label5
'
Me.Label5.Dock = System.Windows.Forms.DockStyle.Top
Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.Color.Lime
Me.Label5.Location = New System.Drawing.Point(0, 0)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(469, 24)
Me.Label5.TabIndex = 40
Me.Label5.Text = "CsvToWav"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Button5
'
Me.Button5.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button5.ForeColor = System.Drawing.Color.Lime
Me.Button5.Location = New System.Drawing.Point(376, 352)
Me.Button5.Name = "Button5"
Me.Button5.TabIndex = 39
Me.Button5.Text = "Quitter"
'
'Button4
'
Me.Button4.ForeColor = System.Drawing.Color.Lime
Me.Button4.Location = New System.Drawing.Point(192, 352)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 38
Me.Button4.Text = "Valider"
'
'TextBox4
'
Me.TextBox4.BackColor = System.Drawing.Color.Blue
Me.TextBox4.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(255, Byte), CType(128, Byte))
Me.TextBox4.Location = New System.Drawing.Point(192, 264)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(152, 20)
Me.TextBox4.TabIndex = 37
Me.TextBox4.Text = ""
'
'TextBox3
'
Me.TextBox3.BackColor = System.Drawing.Color.Blue
Me.TextBox3.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(255, Byte), CType(128, Byte))
Me.TextBox3.Location = New System.Drawing.Point(192, 200)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(152, 20)
Me.TextBox3.TabIndex = 34
Me.TextBox3.Text = ""
'
'TextBox2
'
Me.TextBox2.BackColor = System.Drawing.Color.Blue
Me.TextBox2.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(255, Byte), CType(128, Byte))
Me.TextBox2.Location = New System.Drawing.Point(192, 136)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(152, 20)
Me.TextBox2.TabIndex = 31
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.Color.Blue
Me.TextBox1.ForeColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(255, Byte), CType(128, Byte))
Me.TextBox1.Location = New System.Drawing.Point(192, 72)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(152, 20)
Me.TextBox1.TabIndex = 27
Me.TextBox1.Text = ""
'
'Label4
'
Me.Label4.ForeColor = System.Drawing.Color.Lime
Me.Label4.Location = New System.Drawing.Point(8, 256)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(152, 32)
Me.Label4.TabIndex = 36
Me.Label4.Text = "Nom du fichier .wav à sauvegarder :"
'
'Button3
'
Me.Button3.ForeColor = System.Drawing.Color.Lime
Me.Button3.Location = New System.Drawing.Point(376, 200)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 35
Me.Button3.Text = "Parcourir"
'
'Label3
'
Me.Label3.ForeColor = System.Drawing.Color.Lime
Me.Label3.Location = New System.Drawing.Point(8, 192)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(152, 32)
Me.Label3.TabIndex = 33
Me.Label3.Text = "Emplacement de sauvegarde des fichiers .wav :"
'
'Button2
'
Me.Button2.ForeColor = System.Drawing.Color.Lime
Me.Button2.Location = New System.Drawing.Point(376, 136)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 32
Me.Button2.Text = "Parcourir"
'
'Label2
'
Me.Label2.ForeColor = System.Drawing.Color.Lime
Me.Label2.Location = New System.Drawing.Point(8, 128)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(152, 32)
Me.Label2.TabIndex = 30
Me.Label2.Text = "Emplacement du logiciel TextSpeech Pro :"
'
'Button1
'
Me.Button1.ForeColor = System.Drawing.Color.Lime
Me.Button1.Location = New System.Drawing.Point(376, 72)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 29
Me.Button1.Text = "Parcourir"
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Lime
Me.Label1.Location = New System.Drawing.Point(8, 72)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(112, 23)
Me.Label1.TabIndex = 28
Me.Label1.Text = "Nom du fichier .csv :"
'
'Form1
'
Me.AcceptButton = Me.Button4
Me.AllowDrop = True
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(192, Byte))
Me.CancelButton = Me.Button5
Me.ClientSize = New System.Drawing.Size(469, 388)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "CsvToWav"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'Bouton 5 : Quitter
Dim j As String
j = MsgBox("Souhaitez-vous vraiment quitter ?", MsgBoxStyle.YesNo)
If j = MsgBoxResult.Yes Then
Application.Exit()
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'Bouton 4 : Valider
'Textbox1 : Champ fichier .csv vide
If (TextBox1.Text.Length < 1) Then
MsgBox("Vous n'avez pas rempli le premier champ :" & ControlChars.CrLf & Chr(34) & "Nom du fichier .csv" & Chr(34), MsgBoxStyle.Critical)
Else
'Textbox1 : Champ fichier .csv erroné
If Not (Path.GetExtension(TextBox1.Text) Like ".csv") Then
MsgBox("L'extension du fichier sélectionné n'est pas .csv" & ControlChars.CrLf & "Veuillez corriger.", MsgBoxStyle.Critical)
Else
'Textbox2 : Champ fichier TextSpeechPro.exe vide
If (TextBox2.Text.Length < 1) Then
MsgBox("Vous n'avez pas rempli le deuxième champ :" & ControlChars.CrLf & Chr(34) & "Emplacement du logiciel TextSpeech Pro" & Chr(34), MsgBoxStyle.Critical)
Else
'Textbox2 : Champ fichier TextspeechPro.exe erroné
If Not (TextBox2.Text Like "*\TextSpeechPro.exe") Then
MsgBox("Vous n'avez pas sélectionné le bon fichier TextSpeechPro.exe", MsgBoxStyle.Critical)
Else
'Textbox3 : Champ répertoire de sauvegarde des fichier .wav vide
If (TextBox3.Text.Length < 1) Then
MsgBox("Vous n'avez pas rempli le troisième champ :" & ControlChars.CrLf & Chr(34) & "Emplacement de sauvegarde des fichiers .wav" & Chr(34), MsgBoxStyle.Critical)
Else
'Textbox4 : Champ de nom de fichier vide
If (TextBox4.Text.Length < 1) Then
MsgBox("Vous n'avez pas rempli le quatrième champ :" & ControlChars.CrLf & Chr(34) & "Nom du fichier .wav à sauvegarder" & Chr(34), MsgBoxStyle.Critical)
Else
'Création d'un répertoire dans lequel seront stockés les fichiers .wav créés
Directory.CreateDirectory(TextBox3.Text & "\" & TextBox4.Text)
pathstockwav1 = TextBox3.Text & "\" & TextBox4.Text & "\"
MsgBox("Les fichiers seront stockés dans le répertoire" & ControlChars.CrLf & pathstockwav1)
indicenom1 = 1
pv1 = 0
'//////////////////////'
'/Ouverture du fichier/'
'//////////////////////'
'Dim numfile1 As Integer
' numfile1 = FreeFile()
'File.Open(numfile1, "C:\Documents and Settings\administrateur.GEMA86\Bureau\$Temp$\test.csv", OpenMode.Binary)
monprocess1.StartInfo.FileName = TextBox1.Text
monprocess1.Start()
monprocess2.StartInfo.FileName = TextBox2.Text
monprocess2.Start()
MsgBox("hey")
'FileClose(numfile1)
End If
End If
End If
End If
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Bouton 1 : sélection du fichier excel (.csv)
With OpenFileDialog1
.Filter = "Fichiers csv|*.csv"
.Multiselect = False
.CheckFileExists = True
End With
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Bouton 2 : sélection du fichier TextSpeechPro.exe
With OpenFileDialog2
.Filter = "Fichiers exe|TextSpeechPro.exe"
.Multiselect = False
.CheckFileExists = True
End With
OpenFileDialog2.ShowDialog()
TextBox2.Text = OpenFileDialog2.FileName
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Bouton 3 : sélection de l'emplacement de sauvegarde des fichiers .wav à créer
FolderBrowserDialog1.ShowDialog()
TextBox3.Text = FolderBrowserDialog1.SelectedPath
End Sub
End Class |
Partager