Solved

Visual Basic Programmin

Posted on 2011-02-23
5
5,753 Views
Last Modified: 2013-11-26
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
Comment
Question by:jtalbott
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 34963043
Just copy and paste the lines (excluding sub/end sub) that you recorded after the Sendkeys line in the original macro, I guess.
0
 

Author Comment

by:jtalbott
ID: 34963150
I do not see a send key.
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 34963297
Then look again. :-)
0
 

Author Comment

by:jtalbott
ID: 34963911
Gatcha. thanks
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 34963993
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question