sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Retrieve screen data from Macro

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieve screen data from Macro

    Hi everyone,

    I've got a macro, which uses an XLS file to enter data into a screen. What I would like to do is to improve this, so I can retrieve data from a certain part of the screen and then conditionally enter some other data. I'm quite happy with the process of sending data to screen, and the logic process behind it.. What I don't know how to do is grab text from the screen from a specific location?

    Is it possible?

  • #2
    Re: Retrieve screen data from Macro

    Sorry,

    Appears I've managed to answer my own question - I can use autECLSession.autECLPS.GetText(4, 21, 8)

    Comment


    • #3
      Re: Retrieve screen data from Macro

      First, what product are you using? Second, assuming it's an iSeries Access emulator, is it a "macro" or a "script" (VBscript)?

      I'm not aware of much 'macro' capability for 'grabbing' data from the screen, mostly because there is no variable declaration capability. What could the macro do with data after it was grabbed without any local storage for later reference.

      I suppose you could test specific screen locations for literal data with a WAIT statement that has both a timeout and a wait-condition. Use a minimal timeout value like "1 msec". Put a GOTO label ON TIMEOUT after the WAIT to test if the GOTO was reached by the timeout. Follow that by another WAIT with timeout and another wait-condition, and another GOTO label ON TIMEOUT. Use as many WAIT and GOTO pairs as needed to make all potential tests.

      But if you actually mean "script", then you have reasonably full access to screen data and local script variables. Much more advanced manipulation is possible.
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: Retrieve screen data from Macro

        And sorry, too. Your second post came up when I hit <Enter>.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Re: Retrieve screen data from Macro

          No problem Tom, you are right I call it a macro because I go to the Play Macro / Script button on the iSeries, but it is essentially vbScript. I'm using an excel sheet to enter data, but need to conditionally select other pieces of data depending on what is on screen (hence the need to grab data).

          Think I'm happy with this now, although I do have one annoying issue at the moment which my limited knowledge of macro / script writing doesn't cover.

          I'm testing my script and it runs ok, but then other times it hangs, no obvious error, and it will hang in different places each time. I've stripped out all XLS manipulation at the moment to make sure it's nothing to do with file locking, but still the script will hang and my session will stick.

          Script below, any idea what I am missing?

          [PCOMM SCRIPT HEADER]
          LANGUAGE=VBSCRIPT
          DESCRIPTION=
          [PCOMM SCRIPT SOURCE]
          OPTION EXPLICIT
          autECLSession.SetConnectionByName(ThisSessionName)

          '------------------------------------------------
          ' Variable set-up and initialisation
          '------------------------------------------------
          Dim objXL, wbDest, wksDest
          Dim currentRow
          dim Company, Vendor, Invoice
          Company = "1"
          Vendor = "123"
          Invoice = "4567"

          '------------------------------------------------
          ' Initialise the screen function and data entry.
          '------------------------------------------------
          autECLSession.autECLPS.SetText "MENUAS", 23, 41
          autECLSession.autECLOIA.WaitForAppAvailable
          autECLSession.autECLPS.SendKeys "18"
          autECLSession.autECLOIA.WaitForAppAvailable
          autECLSession.autECLPS.SendKeys "[pf8]"
          autECLSession.autECLOIA.WaitForAppAvailable


          '------------------------------------------------
          ' Enter Invoice Details
          '------------------------------------------------
          autECLSession.autECLPS.WaitForCursor 6,66,10000
          autECLSession.autECLPS.SendKeys Company
          autECLSession.autECLPS.SendKeys "[field+]"
          autECLSession.autECLPS.SendKeys Vendor
          autECLSession.autECLPS.SendKeys "[field+]"
          autECLSession.autECLPS.SendKeys Invoice
          autECLSession.autECLPS.SendKeys "[enter]"
          autECLSession.autECLOIA.WaitForAppAvailable
          autECLSession.autECLPS.SendKeys "[pf14]"
          autECLSession.autECLOIA.WaitForAppAvailable
          autECLSession.autECLPS.SendKeys "[pf5]"
          autECLSession.autECLOIA.WaitForAppAvailable

          Comment

          Working...
          X