• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5858
  • Last Modified:

Visual Basic Programmin

I am trying to modify an existing macro. The existing macro automaticall puts in today's date. I want to add to the macro. I want it to also put in a some more text, the user's first initial and last name, thier unit code, job title and office code . For Example: 02/23/11 jtalbott Job tile: TSR Office : E14 Unit: 3311.
Here is the existing macor:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBScript
DESCRIPTION=Today's Date mmddyy

[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT

REM Created by Bill Louden, Seattle RO.  Last modified 01/03/05 at 9:01 AM PT.
REM Types the current 6-digit date at whatever point the cursor is placed.
REM ------------------------------------------------------------------------------------------------
      REM Declare the objects
      REM ECLPS is the (P)resentation (S)pace
      REM ECLSession is the Session
      REM ECLOIA is the (O)peration (I)nformation (A)rea

Dim objautECLPS
Dim objautECLSession
Dim objautECLOIA
Dim sysObj
Dim DateToday
Dim DateMonth
Dim DateDay
Dim DateYear
Dim CurPosRow
Dim CurPosCol

      REM Set and activate the objects

Set objautECLPS = CreateObject("PCOMM.autECLPS")
objautECLPS.SetConnectionByName(ThisSessionName)

Set objautECLSession = CreateObject("PCOMM.autECLSession")
objautECLSession.SetConnectionByName(ThisSessionName)

Set objautECLOIA = CreateObject("PCOMM.autECLOIA")
objautECLOIA.SetConnectionByName(ThisSessionName)

Set sysObj = CreateObject("PCOMM.autSystem")
'------------------------------------------------------------------------------------------------

subSub1_
sub subSub1_()

If objautECLPS.getText(2, 64, 6) = "TERMID" then

            REM Check to see if user is on the SSA MAIN MENU.

      MsgBox "Please Login first.",, "User Not Logged In"

      Exit Sub

ElseIf objautECLPS.getText(2, 77, 4) = "CIGN" Then

            REM Check to see if user is on the Welcome/Login screen.

      MsgBox "Please Login first.",,"User Not Logged In"

      Exit Sub

ElseIf objautECLPS.getText(1, 11, 53) = "Enter Password To Unlock; CESF Or Clearkey To Signoff" Then

            REM Check to see if user is locked out (but logged in).

      MsgBox "Mainframe is locked:  Password required." & Chr(13) & "Enter your password and try again." , ,"User Locked Out"

      Exit Sub
Else

      CurPosRow = objautECLPS.CursorPosRow
      CurPosCol = objautECLPS.CursorPosCol
      DateMonth = Month(date)      
      DateDay = Day(date)
      DateYear = Year(date)      

      If DateMonth < 10 Then
            DateMonth = "0" & DateMonth
      End If
      If DateDay < 10 Then
            DateDay = "0" & DateDay
      End If
      DateYear = Mid(DateYear, 3, 2)

      DateToday = DateMonth & DateDay & DateYear

      objautECLPS.sendkeys DateToday

      Set objautECLPS = Nothing
      Set objautECLSession = Nothing
      Set objautECLOIA = Nothing
      Set sysObj = Nothing
      Set DateToday = Nothing
      Set DateMonth = Nothing
      Set DateDay = Nothing
      Set DateYear = Nothing
      Set CurPosRow = Nothing
      Set CurPosCol = Nothing
      
      Exit Sub

End If

End Sub

HERE is a macor I recorded that shows what I want added to the exisitng macro:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "E14 jtalbott TSR Office E14 Unit 3311"
end sub
0
jtalbott
Asked:
jtalbott
  • 3
  • 2
1 Solution
 
Gary PattersonVP Technology / Senior Consultant Commented:
Just copy and paste the lines (excluding sub/end sub) that you recorded after the Sendkeys line in the original macro, I guess.
0
 
jtalbottAuthor Commented:
I do not see a send key.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
Then look again. :-)
0
 
jtalbottAuthor Commented:
Gatcha. thanks
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
After this line in the original script:

  objautECLPS.sendkeys DateToday

Paste these lines from your recorded macro:

   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "E14 jtalbott TSR Office E14 Unit 3311"

And now the macro will:

Send the characters in the DateToday variable to the current screen.
Wat for the application to return to "Available" status
Wait for the emulator session to return to "Input Ready" status
Send "E14 jtalbott TSR Office E14 Unit 3311" to the current screen.

- Gary Patterson

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now