I have the following macro/script and need to add after every program (where I have left the spaces with *********************** either side where these commands need to go) an if command that if the macro finds text in the first 8 characters of this field to capture this info and save to a .txt file.
i.e screen
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
yyyyyyyy < --------------If text here it captures it if blank it carries on
the macro.
Thanks in advance here is the macro
Please let me know the commands to put in the gaps I have left!!!
==========================================================
Here Goes!!!
visual basic code:--------------------------------------------------------------------------------' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
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("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM1<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right><Right><Left>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys ("PROGRAM2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM3<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right><Right><Right><Left><Left>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM5<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout
End Sub
i.e screen
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
yyyyyyyy < --------------If text here it captures it if blank it carries on
the macro.
Thanks in advance here is the macro
Please let me know the commands to put in the gaps I have left!!!
==========================================================
Here Goes!!!
visual basic code:--------------------------------------------------------------------------------' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
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("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM1<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right><Right><Left>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys ("PROGRAM2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM3<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
********************************************************
********************************************************
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right><Right><Right><Left><Left>COMMAND4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.Sendkeys("PROGRAM5<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<COMMAND1>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("COMMAND2<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND3<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Right><Right><Right><Right><Right><Right>COMMAND4<Enter>")
********************************************************
********************************************************
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Attn>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout
End Sub