Soyez le premier à donner votre avis sur cette source.
Vue 5 142 fois - Téléchargée 1 771 fois
'(.frm très simple:) ' orthographe: changer un nom d'un texte et faire les modifications correspondantes (déterminants, A 'qualificatifs, verbes, pronoms) Dim fic As String 'chemin accès fichiers-exercices Dim d(500), d1(500), cm(500) 'données: mot affiché/ mot après modif (ou le même si pas de modif) / commentaire avec code joint 'pour les signes de ponctuation, seul d(n) Dim nat(500) As String 'code nature (cf ci-dessous) Dim ctr(500) As Integer 'contrôle des éléments repérés Dim u As Integer 'N° du changement en cours (N° du label1(u) ou de d(u) Dim chg As Integer 'nb total de modif à faire Dim ncg As Integer 'compteur modif effectuées Dim dat As Integer 'drapeau pour rester sur l'étiquette pointée tant qu'elle n'est pas traitée Dim pecr As Integer 'drapeau pour écriture en cours Dim repe As String Dim erreurs As Integer, tfin, score As String, j As Integer Dim ea As Integer, inv As Integer, pr As Integer, aq As Integer, veb As Integer, det As Integer 'compteurs d'erreurs de modif 'suites de label1(n): chacun correspondant à un mot ou à un signe de ponctuation ' ds le txt joint, chaque signe ou mot est recopié avec commentaire sur sa modif ou non ' prévoir une aide programmée qui repère mots et signes de ponctuation ' aides précopiées (ex: mot qui ne varie pas (sans commentaire adapté)) ' penser aux codes pour le comptage des types d'erreurs: ' codes: *+(espace) =err déterminant "* " ' -+(espace) err accord Aq "- " ' =+(espace) err verbe "= " ' (espace)+P = (Pronom) " P" ' (rien) err "de sens" Private Sub Command1_Click() 'charger Label4 = "": Label4.Visible = False Command1.Visible = False CommonDialog1.Filter = "Fichiers au format txt(*och.txt)|*och.txt|" CommonDialog1.FilterIndex = 1 CommonDialog1.ShowOpen fic = CommonDialog1.FileName charge End Sub Private Sub charge() n = 0 Open fic For Input As #1 Input #1, mar, mam, mmm Do Until EOF(1) Input #1, d(n): If d(n) <> "," And d(n) <> "-" And d(n) <> "." And d(n) <> "..." And d(n) <> ";" And d(n) <> "?" And d(n) <> "" Then Input #1, d1(n), cm(n) Else ctr(n) = -1 nat(n) = "" If ctr(n) = 0 And d1(n) <> d(n) Then chg = chg + 1 If cm(n) = "*" Then cm(n) = "Qu'il y ait un(e) ou plusieurs " & mmm & ", cet élément ne varie pas." '(sur exercices antérieurs) If cm(n) = "inv" Then cm(n) = "mot invariable quelle que soit la transformation" If Left(cm(n), 2) = " P" Or Left(cm(n), 2) = " p" Then nat(n) = " P": cm(n) = Mid(cm(n), 3) If Left(cm(n), 2) = "* " Then nat(n) = "* ": cm(n) = Mid(cm(n), 3) If Left(cm(n), 2) = "= " Then nat(n) = "= ": cm(n) = Mid(cm(n), 3) If Left(cm(n), 2) = "- " Then nat(n) = "- ": cm(n) = Mid(cm(n), 3) n = n + 1 Loop Close #1: nt = n: n = 0 Text1.Left = 100: Text1.Top = 3000: Text1.Width = 11500: Text1.Visible = True: Text1.Text = "Cliquez sur un mot qui doit changer, puis modifiez-le ; validez en tapant [ENTREE]": Text1.Locked = True Label5 = "Remplacez ''" & mar & "'' par ''" & mam & "'' :" Label2(0).Visible = True: Label3(0).Visible = True gau = Label2(0).Left + Label2(0).Width + 200: For xx = 1 To 5: Load Label2(xx): Load Label3(xx): Label2(xx).Left = gau: Label3(xx) = "": Label3(xx).Left = gau: gau = gau + 200 + Label2(0).Width: Label2(xx).Visible = True: Label3(xx).Visible = True: Next xx Label2(0) = "E. de choix de mots": Label2(1) = "E.d'accord S-V" Label2(2) = "E. nom-pronom": Label2(3) = "E.d'accord NOM-Adj": Label2(4) = "E. de déterminant": Label2(5) = "E.de sens" Label4.Visible = False gau = 0: ht = 500: For xx = 0 To nt If xx > 0 Then Load Label1(xx) Label1(xx) = d(xx): gau1 = gau + Label1(xx).Width + 90: If gau1 > 11980 Then gau = 50: gau1 = gau + Label1(xx).Width + 90: ht = ht + Label1(0).Height + 300 Label1(xx).Left = gau: Label1(xx).Top = ht: gau = gau1: Label1(xx).Visible = True If d(xx) = mar Then Label1(xx).BackColor = &H8000000B: Label1(xx).ForeColor = &H8000000C '&H404040 Next xx Form1.Caption = "(0/" & Trim(Str(chg)) & ") clique sur un mot à modifier; corrige, puis VALIDE avec [ENTREE]" End Sub Private Sub Form_Load() Text1.Visible = False Label2(0).Visible = False: Label3(0).Visible = False Label4.Visible = True Label4 = "Choisis un texte à modifier selon la consigne" End Sub Private Sub Form_Unload(Cancel As Integer) If ncg < chg Then a = MsgBox("Il te restait" + Str(chg - ncg) + " mots à modifier." + Chr(10) + "Tu devrais essayer de reprendre..." + Chr(10) + Chr(10) + Chr(10) + " pour pour" + Chr(10) + " arrêter continuer:", vbOKCancel, "Alors.... ???") If a = 2 Then Cancel = 1 Else If tfin = 1 Then Exit Sub Else pts = j - erreurs: If pts < 0 Then pts = 0 MsgBox ("Au revoir" + Chr(10) + Str(pts) + " point(s)") score = Chr(13) & Chr(10) & "Incomplet:" & Chr(13) & Chr(10) & fic enreg End If End Sub Private Sub Label1_Click(index As Integer) If dat = 1 Then Exit Sub Text1.Locked = False: Text1.Visible = False: Label4.Visible = False: Label4 = "" If ctr(index) = -1 Or pecr = -1 Or InStr(",;.?!", d(index)) <> 0 Then Exit Sub If d(index) = d1(index) Then erreurs = erreurs + 1: Form1.Caption = " (" & Trim(Str(ncg)) & "/" & Trim(Str(chg)) & ") Clique uniquement sur les mots à modifier (ensuite modification et validation avec [ENTREE])": a = MsgBox(cm(index), , "Ce mot ne varie pas."): inv = inv + 1: Label3(0) = inv: Label4.Visible = True: Label4 = d(index) & ": " & cm(index): Exit Sub u = index: Text1.Text = Label1(index).Caption: pecr = -1: Text1.Left = Label1(index).Left - 50: Text1.Top = Label1(index).Top + 300: Text1.Height = Label1(index).Height: Text1.Width = Label1(index).Width + 500: Text1.SelStart = Len(d(index)): Text1.Visible = True Form1.Caption = " (" & Trim(Str(ncg)) & "/" & Trim(Str(chg)) & ") corrige, puis VALIDE avec [ENTREE]" dat = 1 End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If Text1.Locked = True Then Exit Sub car = Chr$(KeyAscii) If InStr(" -éèàîôâêûï'" + Chr$(8) + Chr$(13), car) <> 0 Or (car >= "A" And car <= "z") Or (car >= "0" And car <= "9") Then If car = Chr$(13) Then KeyAscii = 0: repe = Trim(Text1.Text): verif: Exit Sub KeyAscii = Asc(car) Else KeyAscii = 0 End If End Sub Private Sub verif() If LCase(repe) = LCase(d1(u)) Then If Len(repe) >= Len(d(u)) Then If Len(repe) > Len(d(u)) * 3 / 2 Then Label1(u).FontSize = 9 Else Label1(u).FontSize = 12 Label4.Visible = False: Label4 = "": Label1(u).BackColor = vbCyan: Label1(u) = d1(u): ncg = ncg + 1: ctr(u) = -1: pecr = 1: Text1.Visible = False: j = j + 1: dat = 0 If ncg < chg Then Form1.Caption = " - EXACT - (" & Trim(Str(ncg)) & "/" & Trim(Str(chg)) & ") clique sur un mot à modifier; corrige, puis VALIDE avec [ENTREE] -EXACT- -CORRECT- -JUSTE- - GOOD - -Continue ainsi! BRAVO- ": ' a = MsgBox("Clique maintenant sur un autre mot", , "EXACT") Else Form1.Caption = " (" & Trim(Str(ncg)) & "/" & Trim(Str(chg)) & ") Félicitations": ' a = MsgBox("Clique maintenant sur un autre mot", , "EXACT") tx = 100 - Int((ea + pr + veb + aq + det + inv) * 100 / chg): If tx < 0 Then tx = 0 a = MsgBox("BRAVO, tu as terminé les changements." + Chr(10) + "avec " + Str(tx) + " % de réussite" + Chr(10) + "remarque:" + Str(inv) + " mots mal choisis.)", , "Au revoir"): clair End If Else erreurs = erreurs + 1: a = MsgBox(cm(u) + Chr(10) + "Relis aussi; peut-être as-tu effacé ou ajouté quelquechose - Merci.", , "Voici une indication pour corriger:") If nat(u) = " P" Then pr = pr + 1: Label3(2) = pr Else If nat(u) = "* " Then det = det + 1: Label3(4) = det Else If nat(u) = "= " Then veb = veb + 1: Label3(1) = veb Else If nat(u) = "- " Then aq = aq + 1: Label3(3) = aq Else ea = ea + 1: Label3(5) = ea Label4.Visible = True: Label4 = cm(u) + Chr(10) + "Pense aussi à relire le mot." End If End Sub Private Sub clair() tfin = 1: pts = j - erreurs / 2: If pts < 5 Then pts = 5 MsgBox ("Tu es arrivé au bout!" + Chr(10) + "avec " + Str(pts) + " points."): score = Chr(13) & Chr(10) & fic enreg End End Sub Private Sub enreg() score = score & Date & Chr(13) & Chr(10) & Time & Chr(13) & Chr(10) & "(justes:" & Str(j) & "/" & Trim(Str(chg)) & ")- erreurs=" & Str(erreurs): score = score & Chr(13) & Chr(10) & "e choix:" & Str(inv) & " e.pronoms:" & Str(pr) & " e .déterminants:" & Str(det) & " e.Aq:" & Str(aq) & " e.verbes:" & Str(veb) & " autres:" & Str(ea) Open "c:\scororthochger.txt" For Append As #1 Print #1, score Close #1 End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.