INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Open previously saved sessions with Visual Basic

Open previously saved sessions with Visual Basic

(OP)
I have previously saved sessions for each cost center in "R:\Cost Centers\Sessions\. If I don't use these sessions at least once every ninety days, they are automatically disabled. I would like to set up a little VBA macro to open each session and logon in. Once the session is open, I will be able to navigate around the screen and login as I already have macros that do the login piece. I'm struggling with opening each session. Any help would be greatly appreciated. Thank you for taking the time to look at this...........We are using Reflections 2014

RE: Open previously saved sessions with Visual Basic

Hi,

When you say Session, are you referring to a Screen (transaction) accessing the same mainframe db?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Open previously saved sessions with Visual Basic

(OP)
Skip...........When I refer to session, I'm referring to a specific "rd5x" file that was previously saved. Our company uses different machines / mainframes for different cost centers. The macros I write generally start with a "rd5x" file already open. However, in this case, I want to open a specific "rd5x" file. Once it is open, I can automate the login process, close the file and then move on to the next one. Thanks for the help. Let me know if you have any more questions.....Shaves

RE: Open previously saved sessions with Visual Basic

My experience is with AttachmateExtra.

In Extra, the System can be opened with a saved file as you have indicated, that connects the emulator to the specific mainframe. Sessions are objects within a System.

In Extra you can Set a System object via a file to open that mainframe connection. Then establish the ActiveSession as the Session to which a Screen can be assigned.

Don't know what the Reflections syntax is to accomplish that.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Open previously saved sessions with Visual Basic

(OP)
Can you show me some code to open a session in Extra....maybe I can compare the code to Reflections and see if I can find something similar? Thanks

RE: Open previously saved sessions with Visual Basic

Here's some code I used before I retired. I always ran from Excel VBA because I was screen scraping for my users. Turns out I was wrong about System. It IS the Session object that assigns the mainframe...

CODE

Option Explicit
'you must have a reference set for Attachmate EXTRA! n.m Object Library
'runs with Form ufmPassword

Public oSystem As ExtraSystem
Public oSessions As ExtraSessions
Public oSess As ExtraSession
Public oScrn As ExtraScreen
Public vPassword
Public sCurrentScreenName As String

Sub IMS_Login(Optional bContinue As Boolean = False)

    Dim result, bLogin As Boolean
    
    Set oSystem = CreateObject("Extra.System")
    
    If oSystem.Sessions.Count = 0 Then
        Set oSess = oSystem.Sessions.Open("C:\Program Files\E!PC\Sessions\Mainframe.edp")
'        ufmPassword.Show
        ufmPassword.Show
        bLogin = True
    Else
        Set oSess = oSystem.ActiveSession
        bLogin = False
    End If
    
    With oSess
        .Visible = True
        .WindowState = xNORMAL
    End With

    Set oScrn = oSess.Screen
    If (oScrn Is Nothing) Then GoTo ExitMacro
    
    oSystem.TimeoutValue = 100
    
    With oScrn
        If bLogin Then
        ' BHT SignOn
            Do Until .WaitForCursor(17, 28)
                DoEvents
            Loop
            .Area(17, 28, 17, 28) = "S"
            .SendKeys ("<ENTER>")
        ' Login
            Do Until .WaitForCursor(14, 37)
                DoEvents
            Loop
            .Area(14, 37, 14, 46) = fOSUserName()
            .Area(15, 37, 15, 46) = vPassword
            .SendKeys ("<ENTER>")
        ' SuperSession
            Do Until .WaitForCursor(9, 2)
                DoEvents
            Loop
            .Area(11, 2, 11, 2) = "S"
            .SendKeys ("<ENTER>")
        ' IMS Ready
        End If
    End With

'...Macro Magic happens here...

ExitMacro:
    If bContinue Then Exit Sub
    Set oScrn = Nothing
    Set oSess = Nothing
    Set oSystem = Nothing
End Sub 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Open previously saved sessions with Visual Basic

(OP)
Sorry for the delayed response. That is exactly what I am doing. Running a macro and screen scraping data for end users. I'm going to work with this next week to see if I can get it to work for me. The only difference is that I haven't used EXTRA. Thanks for all of the help with this........

RE: Open previously saved sessions with Visual Basic

My experience has been that I started in Extra VB but very quickly realized that since mr data was to end up in Excel to send to my users and since I often has a source list to begin with in Excel as well and since the VB editor was klunky compared to the Excel VB editor, I did ALL my coding in Excel.

I you do as well, add a Reference in Excel VB via Tools > References to the Reflections object library.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close