Solved

Visual Basic Programmin

Posted on 2011-02-23
5
5,729 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now