Bonjour,
J’espère être dans le bon endroit…
j’utilise une appli Attachmate pour avoir des données chiffrées. On tape une ligne de code et on obtient un résultat. Je veux copier ce résultat et l’enregistrer sour forme de fichier TXT en créant un nouveau fichier txt. Apparemment on pourrait passer par le presse papier de windows. Mais je galère pas mal…
Voici un exemple :
’ Global variable declarations
Global g_HostSettleTime%
Sub Main()
'--------------------------------------------------------------------------------
’ Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject(“EXTRA.System”) ’ Gets the system object
If (System is Nothing) Then
Msgbox “Could not create the EXTRA System object. Stopping macro playback.”
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
’ Set the default wait timeout value
g_HostSettleTime = 3000 ’ milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
’ Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox “Could not create the Session object. Stopping macro playback.”
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
’ This section of code contains the recorded events
Sess0.Screen.Sendkeys(“LA LIGNE DE CODE QUE JE TAPE<Enter>”)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'LA REPONSE ARRIVE ICI ET JE LA COPIE
Sess0.Screen.Copy
System.TimeoutValue = OldSystemTimeout
End Sub
et à ce moment là je voudrais que ça m’enregistre la réponse dans un fichier qui s’appellerait par exemple C:/resultat.txt
Quelqu’un pourrait il m’aider ?
merci de votre aide en tout cas…