This question is similar to others in the forum, but none seem answer the obvious. If I have sessions ABC1 and ABC2, the last one opened ABC2 is always the active one.
If I run the following macro from ABC1 it only runs in ABC2 !
How do I get macro to run from the session where I use Tools/Macro/Run ?
I would have thought this code line would set it all up correctly ?
Set Sess0 = System.ActiveSession
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
'--------------------------------------------------------------------------------
' 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 = 1000 ' 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("<Clear>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("ZOLDR DI L *<Enter>")
System.TimeoutValue = OldSystemTimeout
End Sub
If I run the following macro from ABC1 it only runs in ABC2 !
How do I get macro to run from the session where I use Tools/Macro/Run ?
I would have thought this code line would set it all up correctly ?
Set Sess0 = System.ActiveSession
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
'--------------------------------------------------------------------------------
' 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 = 1000 ' 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("<Clear>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("ZOLDR DI L *<Enter>")
System.TimeoutValue = OldSystemTimeout
End Sub