Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveSession Question

Status
Not open for further replies.

vzachin

Technical User
Feb 10, 2006
305
US
hi,

the following code is from the Help files but it doesn't always seem to return the correct session.
for example,if i open 4 consecutive sessions and i run the code, session 4 would show as the active session.
then if i do one transaction (sendkey) in session, and run the code again, it would still show session 4 as the active session.
only after several transactions (sendkeys) would the code show correctly as session 1.
the sendkey can be an enter or pf1..etc...
i'm using myExtra Enterprise 7.11v
any ideas?

thanks
zach

Code:
Sub main()
    Dim Sys As Object, Sess As Object
    Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
    Set Sess = Sys.ActiveSession
    SessionName$ = Sess.Name
    MsgBox "The active session is " + SessionName$ + "."
End Sub
 
hi,

here is my dilema
if i have multiple screens open, i can only work in one session at a time. the remaining open sessions will eventually time out (30 minutes) if i don't do something in the session.
what i want to do is run a timed script to evoke a sendkey (maybe an enter or Pf key) in each of the other sessions that are currently inactive.
but i need to be able to figure out which session i'm active in.

i can be active in any session at any given time...
the above code in my original post doesn't work 100%..

any ideas?
zach
 
Hi,

Since sessions is a collection of session objects, why even bother with activesession? You can "work" in any session that is in the collection.
Code:
for i = 1 to oSys.Sessions.count
   msgbox oSys.Sessions(1).name
next


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top