Unidentified Hang Time Between Loop Iterations

Glamador
NewLounger
Posts: 1
Joined: 27 Jun 2013, 17:14

Unidentified Hang Time Between Loop Iterations

Post by Glamador »

Forgive me if this looks like really sloppy code, as it's adapted from a recorded macro. This is my first time coding in VBScript and most of these function calls are Greek to me. But I've got a little loop that looks like this:

Code: Select all

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

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
   DIM count
   For count = 3479 To 3661

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys count
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 4,33,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 4,34,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[tab]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "2"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 9,43,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 9,44,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[tab]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[tab]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "REDACTED TEXT HERE"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[field+]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "33324"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[field+]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 9,31,"00","3c",3,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 6,63,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 6,64,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "y"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"

   autECLSession.autECLPS.WaitForAttrib 4,33,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 4,34,10000

   Next
end sub
And it runs just fine (though it didn't want to run at all before I added "DIM count" up at the top for some reason). But it hangs for some time (maybe 5 seconds) between loop iterations.

I coded this because A) doing a couple of hundred iterations of this by hand is tedious and B) I wanted it done a lot faster than I could do it manually. I've got A) covered at this point but B) is being a pain. It's hardly moving faster than I could do it myself.

What have I done wrong?

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Unidentified Hang Time Between Loop Iterations

Post by HansV »

Welcome to Eileen's Lounge!

I guess it depends on how responsive the terminal window is - there are lots of instructions in the code that wait for up to 10000 milliseconds = 10 seconds for something to happen. If one of these steps keeps the code waiting for several seconds, it would explain the slowness that you experience.
Best wishes,
Hans