Help with repeating command on IBM PCOMM

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

moktarious wrote:How can I make the OK go on with the rest of the script and the cancel to abort it?
If MsgBox("The Queue is been monitored for new call, an Alarm will be triggered when [NEW] or [ST] call are created within the Queue!", vbOKCancel) = vbCancel Then Exit Sub
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Awesome this one work!

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

moktarious wrote:U mean

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 3) <> "ST"

hehe ;)
Nearly, try:

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST"
or maybe:
Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or <> "ST"
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST" ------- Nothing happend
Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or <> "ST -------- syntax error

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

Nathan

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or <> "ST"

will not do what you want, you MUST repeat the variable.
Best wishes,
Hans

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Nathan

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or <> "ST"

will not do what you want, you MUST repeat the variable.


SYNTAX Error HansV, and btw Thanks for your help also

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

moktarious wrote: Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or <> "ST -------- syntax error
I was clutching at straws here, I did not think it would work....
moktarious wrote:Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST" ------- Nothing happend
I don't understand what you mean by nothing happens? It seems an acceptable syntax to me. I cannot see any other approach?
:wales: Nathan :uk:
There's no place like home.....

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

Can you post your entire code preferably between code tags? :smile:
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST" (the loop keep on running, and there is a "NEW" call in the queue)

Code: Select all

'REM This line calls the macro subroutine

subSub1_

Sub subSub1_()

If MsgBox("An Alarm will be triggered when [NEW] or [ST] call are created within the Queue!", vbOKCancel, "                             The Queue will be monitored for new call") = vbCancel Then Exit Sub

'Once logged in and at the local queue, with all service call listed.....
    Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW"
        autECLSession.autECLOIA.WaitForAppAvailable
        autECLSession.autECLOIA.WaitForInputReady
        autECLSession.autECLPS.SendKeys "ci"        'Screen coordinates 22/28 (Need the syntax)
        autECLSession.autECLOIA.WaitForInputReady
        autECLSession.autECLPS.SendKeys "[enter]"
        autECLSession.autECLPS.Wait 10000 'milliseconds - adjust as required
    Loop
   
    MsgBox "New Call Found", vbExclamation, "    ***WARNING***"
End Sub 
Last edited by moktarious on 09 Oct 2011, 19:14, edited 2 times in total.

User avatar
StuartR
Administrator
Posts: 12611
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Help with repeating command on IBM PCOMM

Post by StuartR »

moktarious wrote:U mean

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 3) <> "ST"

hehe ;)
Since there are only two characters in "ST", I think this should have been
Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST"
StuartR


User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

StuartR wrote:
moktarious wrote:U mean

Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 3) <> "ST"

hehe ;)
Since there are only two characters in "ST", I think this should have been
Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" or autECLSession.autECLPS.GetText(5, 26, 2) <> "ST"
We have been there Stuart! :evilgrin: No idea why that won't work, I'm stumped!
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

The loop keep on running, and there is a "NEW" call in the queue, that's what happen.

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

More clutching at straws, try changing the "or" to "and"
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Vegas you rock, that made it.

Now before the whole script start I need the cursor to be at position 22/008.

Please and a million thanks in advance

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

Code: Select all

'REM This line calls the macro subroutine
subSub1_

Sub subSub1_()

If MsgBox("An Alarm will be triggered when [NEW] or [ST] call are created within the Queue!", vbOKCancel, _
    "                             The Queue will be monitored for new call") = vbCancel Then Exit Sub

'Once logged in and at the local queue, with all service call listed.....
    Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" And _
        autECLSession.autECLPS.GetText(5, 26, 2) <> "ST"
            autECLSession.autECLOIA.WaitForAppAvailable
            autECLSession.autECLOIA.WaitForInputReady
            autECLSession.autECLPS.SendKeys("ci", 22, 28)
            autECLSession.autECLOIA.WaitForInputReady
            autECLSession.autECLPS.SendKeys "[enter]"
            autECLSession.autECLPS.Wait 10000 '10 seconds - adjust as required
    Loop
   
    MsgBox "New Call Found", vbExclamation, "    ***WARNING***"
    
End Sub
22/08 or 22/28?

I assume then that when "ci" & [enter] is input, the cursor automatically returns to that position? (else I can't see how this would be working)

Does the above work, else I'll have to find that bit out tomorrow and get back to you, I'm not certain of the syntax.
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

I am the one putting the cursor at 22/008 before starting the macro

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

moktarious wrote:I am the one putting the cursor at 22/008 before starting the macro
Yes, but within the loop, "ci" & enter is continuously entered, so the cursor must default back to that position?

Does
autECLSession.autECLPS.SendKeys("ci", 22, 28)
or
autECLSession.autECLPS.SendKeys ("ci", 22, 28)
work?

Or the equivalent with 22/08
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Well after u press enter, the cursor get back by itself to 22/008

You understand sir?

So let's say my cursor is somewhere in the screen, how I make the script place the cursor to 22/008 before running the macro?

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Help with repeating command on IBM PCOMM

Post by VegasNath »

Or:
autECLSession.autECLPS.SendKeys "ci", 22, 28

It does not matter where the cursor is, the cursor is not required. Does the above work?
:wales: Nathan :uk:
There's no place like home.....

moktarious
StarLounger
Posts: 61
Joined: 08 Oct 2011, 21:25

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Thanks yes now this work, so now let figure out how to make the MsgBox "New Call Found", vbExclamation, " ***WARNING***" loop till the ok is pressed (it will keep beeping, like an alert or alarm u follow me sir?

Code: Select all

'REM This line calls the macro subroutine
subSub1_

Sub subSub1_()

If MsgBox("An Alarm will be triggered when [NEW] or [ST] call are created within the Queue!", vbOKCancel, _
    "                             The Queue will be monitored for new call") = vbCancel Then Exit Sub

'Once logged in and at the local queue, with all service call listed.....
    Do While autECLSession.autECLPS.GetText(5, 26, 3) <> "NEW" And _
        autECLSession.autECLPS.GetText(5, 26, 2) <> "ST" And autECLSession.autECLPS.GetText(6, 26, 3) <> "NEW" And _
        autECLSession.autECLPS.GetText(6, 26, 2) <> "ST"
            autECLSession.autECLOIA.WaitForAppAvailable
            autECLSession.autECLOIA.WaitForInputReady
            autECLSession.autECLPS.SendKeys "ci", 22, 008 
            autECLSession.autECLOIA.WaitForInputReady
            autECLSession.autECLPS.SendKeys "[enter]"
            autECLSession.autECLPS.Wait 10000 '10 seconds - adjust as required
    Loop
   
    MsgBox "New Call Found", vbExclamation, "    ***WARNING***"
   
End Sub