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
| Public Sub ExtraitInfos()
Text1 = "": LigneRecupe$ = "": LabDate = "": LabHeure = ""
NumFiche = FreeFile()
On Error Resume Next
Open "C:\PersoFrancis\Extraire Infos dans un JPG\" & LabOk For Binary Access Read As #NumFiche
If Err.Number = 0 Then
T = 1
Do While T <= 796
CaractereRecupe$ = Input(1, #NumFiche) ' Lit un caractère.
LigneRecupe$ = LigneRecupe$ & CaractereRecupe$
Text1 = Text1 & CaractereRecupe$
T = T + 1
Loop
Close #NumFiche
If InStr(LigneRecupe$, ":") <> 0 Then Extrait_Date
Else
On Error GoTo 0
Text1 = "PAS BON"
End If
End Sub
Public Sub Extrait_Date()
T = InStr(LigneRecupe$, ":")
Do While T <> 0
Msg$ = Mid$(LigneRecupe$, T - 4, 10)
'reformater pour J/M/A
Msg$ = Right$(Msg$, 2) & "/" & Mid$(Msg$, 6, 2) & "/" & Left$(Msg$, 4)
If IsDate(Msg$) = True Then
LabDate = Format(CDate(Msg$), "dddd dd mmmm yyyy")
Extrait_Heure
Exit Do
End If
LigneRecupe$ = Mid$(LigneRecupe$, T + 4, Len(LigneRecupe$) - T)
T = InStr(LigneRecupe$, ":")
Loop
End Sub
Public Sub Extrait_Heure()
Msg$ = Mid$(LigneRecupe$, T + 7, 8): LabHeure = Msg$
End Sub |
Partager