Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy VBscript question, please help (loop request in script) 1

Status
Not open for further replies.

moktarious

Technical User
Oct 8, 2011
2
MA
Good evening to all,

Well I am using IBM Personal Communications to run Macro/VBscript in a session. I have the following script, that type "ci" on the screen then press enter.

I would like to know how I can make it loop. keep writing ci and pressing enter.


[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 "ci"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
end sub
 
Do you mean keep on sending ci <enter>?

Code:
sub subSub1_()
   while true
      autECLSession.autECLOIA.WaitForAppAvailable

      autECLSession.autECLOIA.WaitForInputReady
      autECLSession.autECLPS.SendKeys "ci"
      autECLSession.autECLOIA.WaitForInputReady
      autECLSession.autECLPS.SendKeys "[enter]"
   wend
end sub
It may be a problem if the app dies and gets restarted. The app will keep on receiving ci on startup. You could make it slightly neater using with
Code:
sub subSub1_()
   while true
      with autECLSession
         .autECLOIA.WaitForAppAvailable

         .autECLOIA.WaitForInputReady
         .autECLPS.SendKeys "ci"
         .autECLOIA.WaitForInputReady
         .autECLPS.SendKeys "[enter]"
      .end with
   wend
end sub
 
I did this, and it's working fine for the looping part. Now I would like to know how to stop the loop when at a certain ROW,LINE the character "NEW" or "ST" is found. Then an alarm should be triggered to tell me a new call is on the queue. Thanks for the help



autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine

msgbox"The Queue is been monitored for new call, an Alarm will be triggered when [NEW] or [ST] call are created within the Queue!"

subSub1_

Sub subSub1_()

Do
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "ci"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"


REM Wait for 10 seconds = 10000 milliseconds
autECLSession.autECLPS.Wait 5000
Loop

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top