Run a session for macro and another
Run a session for macro and another
(OP)
Hello,
I want to have two sessions open, I currently have 1 open (primary) and another (backup)
when I run the macro in primary and then click on the backup session the macro starts running in the backup session and doesn't work.
how can I get the macro to only run on primary??
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "\\WPG-YD-F15A\PROVOS02_SYNC$\ATTACHMATE\SESSION\SYLVAIN1.EDP"
' Date: Thursday, May 18, 2006 10:33:33
' User: provos02
'--------------------------------------------------------------------------------
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Declare Sub KeyA (CStation As String)
Declare Sub KeyB (CStation As String, DStation As String, Plan as String)
Declare Sub ScreenCap ()
Sub Main()
'On Error Resume Next
reset
'--------------------------------------------------------------------------------
' 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
System.timeoutvalue = 1500
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 = 1 ' 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)
Kill "c:\data\temp\IMVessel1.txt"
Kill "c:\data\temp\IMVessel2.txt"
call KeyA ("BRAINTTERON")
call KeyA ("MONTASYARPQ")
call KeyA ("CHIINTTERIL")
Beep
OETMP& = Shell("C:\Program Files\Microsoft Office\Office12\excel.exe /R C:\Users\"& Environ$("USERNAME")&"\Documents\Attachmate\Macros\IMVessel.xls", 1)
System.TimeoutValue = OldSystemTimeout
End Sub
Sub KeyA (CStation$)
call KeyB (CStation$,"FAICOVIMPNS","82")
call KeyB (CStation$,"ROBBANK BC","82")
call KeyB (CStation$,"MONTERMONPQ","82")
call KeyB (CStation$,"MONVIATERPQ","82")
call KeyB (CStation$,"HALHALTERNS","82")
call KeyB (CStation$,"STJOHIMPENB","82")
call KeyB (CStation$,"MONWHARF PQ","82")
call KeyB (CStation$,"MONRACTERPQ","82")
call KeyB (CStation$,"VANVANTERBC","82")
call KeyB (CStation$,"VANCENPIEBC","82")
call KeyB (CStation$,"FRASURIMPBC","82")
call KeyB (CStation$,"PRIRUPTERBC","82")
call KeyB (CStation$,"NEWORLEANLA","82")
'call KeyB (CStation$,"PHILADELPPA","82")
'call KeyB (CStation$,"ELIMARTE NJ","82")
call KeyB (CStation$,"FAICOVIMPNS","85")
call KeyB (CStation$,"ROBBANK BC","85")
call KeyB (CStation$,"MONTERMONPQ","85")
call KeyB (CStation$,"MONVIATERPQ","85")
call KeyB (CStation$,"HALHALTERNS","85")
call KeyB (CStation$,"STJOHIMPENB","85")
call KeyB (CStation$,"MONWHARF PQ","85")
call KeyB (CStation$,"MONRACTERPQ","85")
call KeyB (CStation$,"VANVANTERBC","85")
call KeyB (CStation$,"VANCENPIEBC","85")
call KeyB (CStation$,"FRASURIMPBC","85")
call KeyB (CStation$,"PRIRUPTERBC","85")
call KeyB (CStation$,"NEWORLEANLA","85")
'call KeyB (CStation$,"PHILADELPPA","85")
'call KeyB (CStation$,"ELIMARTE NJ","85")
call KeyB (CStation$,"FAICOVIMPNS","95")
call KeyB (CStation$,"ROBBANK BC","95")
call KeyB (CStation$,"MONTERMONPQ","95")
call KeyB (CStation$,"MONVIATERPQ","95")
call KeyB (CStation$,"HALHALTERNS","95")
call KeyB (CStation$,"STJOHIMPENB","95")
call KeyB (CStation$,"MONWHARF PQ","95")
call KeyB (CStation$,"MONRACTERPQ","95")
call KeyB (CStation$,"VANVANTERBC","95")
call KeyB (CStation$,"VANCENPIEBC","95")
call KeyB (CStation$,"FRASURIMPBC","95")
call KeyB (CStation$,"PRIRUPTERBC","95")
call KeyB (CStation$,"NEWORLEANLA","95")
'call KeyB (CStation$,"PHILADELPPA","95")
'call KeyB (CStation$,"ELIMARTE NJ","95")
call KeyB (CStation$,"VANINTTERBC","87")
'call KeyB (CStation$,"PHILADELPPA","87")
call KeyB (CStation$,"VANVANTERBC","87")
call KeyB (CStation$,"VANCENPIEBC","87")
call KeyB (CStation$,"FRASURIMPBC","87")
'call KeyB (CStation$,"ELIMARTE NJ","87")
End Sub
Sub KeyB (CStation$, DStation$, Plan$)
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system 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("<Pf2>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>traf<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>y<Tab><Tab><Tab>"+CStation$+"<Tab><Tab><Tab>"+DStation$+"<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>"+Plan$+"<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>N<ENTER>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>1<Tab><Tab><Tab><Tab><Tab><Tab><Tab>2<Tab><Tab><Tab>3<Tab><Tab><Tab>4<Tab><Tab><Tab><Tab>6<Tab>7<Tab><Tab><Tab><Tab><Tab>8<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>9<Tab><Tab><Tab><Tab><Tab><Tab>10<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab><Tab><Tab>11<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Call ScreenCap ()
End Sub
Sub ScreenCap()
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system 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)
' Name the variables
Dim rc%
Dim MaxColumn%
Dim row%
Dim MaxRows%
Dim filenumA%
Dim filenumB%
Dim Screenbuf$
Dim linebuf$
Dim FileName$
Dim Msg$
Dim InfLoop%
Set Sess0=System.ActiveSession
Set MyScreen=Sess0.Screen
FileIn=FreeFile
'Takes a "snapshot" of current screen and stores it in variable Screenbuf$
MaxRows%=Sess0.Screen.Rows()
MaxColumns%=Sess0.Screen.Cols()
Screenbuf$=""
linebuf$=Space$(MaxColumns%)
linebuf$=Sess0.Screen.Area(1,3,1,6,xBlock)
if Trim(linebuf$) <> "===>" then Exit Sub
filenumA%=Freefile
FileNameA$ = "c:\data\temp\IMVessel1.txt"
Open FileNameA$ for append as filenumA%
filenumB%=Freefile
FileNameB$ = "c:\data\temp\IMVessel2.txt"
Open FileNameB$ for append as filenumB%
For InfLoop%=1 to 100
linebuf$=Sess0.Screen.Area(1,60,1,64,xBlock)
if not right(Trim(linebuf$),1) = "1" then Exit For
For row%=2 to 21
linebuf$=Sess0.Screen.Area(row%,1,row%,MaxColumns%,xBlock)
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Next
msg$ = Chr$(13)+Chr$(10)+Screenbuf$
Write # filenumA%,msg$
Screenbuf$=""
Sess0.Screen.Sendkeys("<Pf11>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For row%=2 to 21
linebuf$=Sess0.Screen.Area(row%,1,row%,MaxColumns%,xBlock)
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Next
msg$ = Chr$(13)+Chr$(10)+Screenbuf$
Write # filenumB%,msg$
Screenbuf$=""
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Sess0.Screen.Sendkeys("<Pf10><Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Next
Close filenumA%
Close filenumB%
End Sub
I want to have two sessions open, I currently have 1 open (primary) and another (backup)
when I run the macro in primary and then click on the backup session the macro starts running in the backup session and doesn't work.
how can I get the macro to only run on primary??
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "\\WPG-YD-F15A\PROVOS02_SYNC$\ATTACHMATE\SESSION\SYLVAIN1.EDP"
' Date: Thursday, May 18, 2006 10:33:33
' User: provos02
'--------------------------------------------------------------------------------
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Declare Sub KeyA (CStation As String)
Declare Sub KeyB (CStation As String, DStation As String, Plan as String)
Declare Sub ScreenCap ()
Sub Main()
'On Error Resume Next
reset
'--------------------------------------------------------------------------------
' 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
System.timeoutvalue = 1500
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 = 1 ' 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)
Kill "c:\data\temp\IMVessel1.txt"
Kill "c:\data\temp\IMVessel2.txt"
call KeyA ("BRAINTTERON")
call KeyA ("MONTASYARPQ")
call KeyA ("CHIINTTERIL")
Beep
OETMP& = Shell("C:\Program Files\Microsoft Office\Office12\excel.exe /R C:\Users\"& Environ$("USERNAME")&"\Documents\Attachmate\Macros\IMVessel.xls", 1)
System.TimeoutValue = OldSystemTimeout
End Sub
Sub KeyA (CStation$)
call KeyB (CStation$,"FAICOVIMPNS","82")
call KeyB (CStation$,"ROBBANK BC","82")
call KeyB (CStation$,"MONTERMONPQ","82")
call KeyB (CStation$,"MONVIATERPQ","82")
call KeyB (CStation$,"HALHALTERNS","82")
call KeyB (CStation$,"STJOHIMPENB","82")
call KeyB (CStation$,"MONWHARF PQ","82")
call KeyB (CStation$,"MONRACTERPQ","82")
call KeyB (CStation$,"VANVANTERBC","82")
call KeyB (CStation$,"VANCENPIEBC","82")
call KeyB (CStation$,"FRASURIMPBC","82")
call KeyB (CStation$,"PRIRUPTERBC","82")
call KeyB (CStation$,"NEWORLEANLA","82")
'call KeyB (CStation$,"PHILADELPPA","82")
'call KeyB (CStation$,"ELIMARTE NJ","82")
call KeyB (CStation$,"FAICOVIMPNS","85")
call KeyB (CStation$,"ROBBANK BC","85")
call KeyB (CStation$,"MONTERMONPQ","85")
call KeyB (CStation$,"MONVIATERPQ","85")
call KeyB (CStation$,"HALHALTERNS","85")
call KeyB (CStation$,"STJOHIMPENB","85")
call KeyB (CStation$,"MONWHARF PQ","85")
call KeyB (CStation$,"MONRACTERPQ","85")
call KeyB (CStation$,"VANVANTERBC","85")
call KeyB (CStation$,"VANCENPIEBC","85")
call KeyB (CStation$,"FRASURIMPBC","85")
call KeyB (CStation$,"PRIRUPTERBC","85")
call KeyB (CStation$,"NEWORLEANLA","85")
'call KeyB (CStation$,"PHILADELPPA","85")
'call KeyB (CStation$,"ELIMARTE NJ","85")
call KeyB (CStation$,"FAICOVIMPNS","95")
call KeyB (CStation$,"ROBBANK BC","95")
call KeyB (CStation$,"MONTERMONPQ","95")
call KeyB (CStation$,"MONVIATERPQ","95")
call KeyB (CStation$,"HALHALTERNS","95")
call KeyB (CStation$,"STJOHIMPENB","95")
call KeyB (CStation$,"MONWHARF PQ","95")
call KeyB (CStation$,"MONRACTERPQ","95")
call KeyB (CStation$,"VANVANTERBC","95")
call KeyB (CStation$,"VANCENPIEBC","95")
call KeyB (CStation$,"FRASURIMPBC","95")
call KeyB (CStation$,"PRIRUPTERBC","95")
call KeyB (CStation$,"NEWORLEANLA","95")
'call KeyB (CStation$,"PHILADELPPA","95")
'call KeyB (CStation$,"ELIMARTE NJ","95")
call KeyB (CStation$,"VANINTTERBC","87")
'call KeyB (CStation$,"PHILADELPPA","87")
call KeyB (CStation$,"VANVANTERBC","87")
call KeyB (CStation$,"VANCENPIEBC","87")
call KeyB (CStation$,"FRASURIMPBC","87")
'call KeyB (CStation$,"ELIMARTE NJ","87")
End Sub
Sub KeyB (CStation$, DStation$, Plan$)
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system 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("<Pf2>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>traf<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>y<Tab><Tab><Tab>"+CStation$+"<Tab><Tab><Tab>"+DStation$+"<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>"+Plan$+"<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>N<ENTER>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab>1<Tab><Tab><Tab><Tab><Tab><Tab><Tab>2<Tab><Tab><Tab>3<Tab><Tab><Tab>4<Tab><Tab><Tab><Tab>6<Tab>7<Tab><Tab><Tab><Tab><Tab>8<Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab><Tab>9<Tab><Tab><Tab><Tab><Tab><Tab>10<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Tab><Tab><Tab>11<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Call ScreenCap ()
End Sub
Sub ScreenCap()
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system 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)
' Name the variables
Dim rc%
Dim MaxColumn%
Dim row%
Dim MaxRows%
Dim filenumA%
Dim filenumB%
Dim Screenbuf$
Dim linebuf$
Dim FileName$
Dim Msg$
Dim InfLoop%
Set Sess0=System.ActiveSession
Set MyScreen=Sess0.Screen
FileIn=FreeFile
'Takes a "snapshot" of current screen and stores it in variable Screenbuf$
MaxRows%=Sess0.Screen.Rows()
MaxColumns%=Sess0.Screen.Cols()
Screenbuf$=""
linebuf$=Space$(MaxColumns%)
linebuf$=Sess0.Screen.Area(1,3,1,6,xBlock)
if Trim(linebuf$) <> "===>" then Exit Sub
filenumA%=Freefile
FileNameA$ = "c:\data\temp\IMVessel1.txt"
Open FileNameA$ for append as filenumA%
filenumB%=Freefile
FileNameB$ = "c:\data\temp\IMVessel2.txt"
Open FileNameB$ for append as filenumB%
For InfLoop%=1 to 100
linebuf$=Sess0.Screen.Area(1,60,1,64,xBlock)
if not right(Trim(linebuf$),1) = "1" then Exit For
For row%=2 to 21
linebuf$=Sess0.Screen.Area(row%,1,row%,MaxColumns%,xBlock)
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Next
msg$ = Chr$(13)+Chr$(10)+Screenbuf$
Write # filenumA%,msg$
Screenbuf$=""
Sess0.Screen.Sendkeys("<Pf11>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For row%=2 to 21
linebuf$=Sess0.Screen.Area(row%,1,row%,MaxColumns%,xBlock)
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Screenbuf$=Screenbuf$+linebuf$+Chr$(13)+Chr$(10)
Next
msg$ = Chr$(13)+Chr$(10)+Screenbuf$
Write # filenumB%,msg$
Screenbuf$=""
if Trim(linebuf$) = ".... End of Report ...." then Exit For
if Trim(linebuf$) = ".... END OF REPORT ...." then Exit For
Sess0.Screen.Sendkeys("<Pf10><Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Next
Close filenumA%
Close filenumB%
End Sub
RE: Run a session for macro and another
What can you identify that distinguishes the sessions?
Your "primary" session ought to be the FIRST session in the Sessions collection: System.Sessions(1), not System.ActiveSession!
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
any ideas??
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
When the macro is running, it stays running on that session untill complete
Even when a new session has been opened thus becoming the active session
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
CODE
for each session that you open, iterate, Sess0, Sess1, Sess2.
this will differentiate each of the sessions.
so if your macro refers to sess0, it will only work on that session
RE: Run a session for macro and another
System.Sessions(1)
Referring to the first session opened.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
Remy - would it be system.sess1?
RE: Run a session for macro and another
What do you mean by "doesn't work?" Please describe what you observed to come to this conclusion.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
You may consider this one case closed. Thank you for your efforts
RE: Run a session for macro and another
what Skip posted is correct. if you found a solution, it would be nice if you would post it so that others can make use of it in the future.
RE: Run a session for macro and another
I thought skip had it, I thought it was working fine with System.Sessions(1) but then it happened again
So if I start my macro in one session and select the other session window, the macro starts running in that session
thanks for all your efforts but still can't find a solution...
anymore help would be greatly appreciated.
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
Is there a way to distinguish a session as session 1 and session 2?
RE: Run a session for macro and another
Consequently the FIRST session that you open would be 1 and the next would be 2, etc.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.Sessions(1)
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
so I changed to this and that message displays when trying to run "Could not create the Session object. Stopping macro playback."
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
' 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
System.timeoutvalue = 1700
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
RE: Run a session for macro and another
CODE
I'd use some other object variable than Sessions.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
If you find anything on your end I would sure appreciate the help, getting close to the deadline.
anyway I appreciate the time, looks like you put a lot of time in on this site
RE: Run a session for macro and another
I may have misunderstood your requirements
You have several open sessions and you are evoking the macro from
let's say session 1.
does the macro go to session 2 or session 3 to do anything?
if you only want the macro to run on session 1, then
as I've said earlier, this would be the problem
CODE
From my past experience, the ActiveSession is the session that is called last or clicked on.
So for the other screens, you can try something like this
CODE
so your code
CODE
RE: Run a session for macro and another
So the question is how can you identify the FIRST session in order to have it execute the necessary code for it and not not execute that code for any other session.
So it would seem to me that Sess0, Sess1, etc is a meaningless exersize, when you can identify the first session in the Sessions collection.
I almost ALWAYS code my Attachmate procedures in Excel VBA, which give me many extra benefits over Extra VB, like being able to BREAK the code and examine an object variable by drilling down using the Watch Window feature in the VBA Editor. So one of the things I'd try to discover is what's in the System.Sessions collection at the time that you get your message.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Run a session for macro and another
Set Sess0 = System.Sessions.Item("Enterfilenameofthefileyouwantittorunon.rd3x")
Works like a charm
Thanks for everyone's help
RE: Run a session for macro and another
Skip,
Just traded in my OLD subtlety...
for a NUance!