Help with repeating command on IBM PCOMM

hotpprs
NewLounger
Posts: 5
Joined: 19 Oct 2010, 14:45

Help with repeating command on IBM PCOMM

Post by hotpprs »

Hello.
I need to repeat a simple command to search a queue over and over.
I am not a programmer, but I know enough to figure out how to get into the VBSCRIPT and edit and save it. I would like the script to wait 10 seconds or so after each search, and then just loop it indefintely. I can just hit a key on the PCOMM task bar to stop the search when I need to.
Here is the script:

____________________________________________________________________________

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=A CS SSRCH
[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 "cs ssrch"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"


end sub

___________________________________________________________________________

Thanks

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

Welcome to Eileen's Lounge!

You can use code like this:

Code: Select all

  Do
    ' Your actions to be repeated here
    ....
    ' Wait for 10 seconds = 10000 milliseconds
    WScript.Sleep 10000
  Loop
Best wishes,
Hans

hotpprs
NewLounger
Posts: 5
Joined: 19 Oct 2010, 14:45

Re: Help with repeating command on IBM PCOMM

Post by hotpprs »

Thanks for the welcome and the assist.

I inserted the statements as follows, and it comes up with an error when I try to run the routine. It states there is a syntax error in line 13.
(Basically, it is the "cs search" command I am trying to repeat every 10 seconds.
Otherwise I have to hit a PF key over and over to accomplish the same task, which is some information that comes up in a queue randomly.)

___________________________________________________________________

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

do
' REM This line calls the macro subroutine
subSub1_


sub subSub1_()
autECLSession.autECLOIA.WaitForAppAvailable

autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "cs ssrch"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"

end sub

' Wait for 10 seconds = 10000 milliseconds
WScript.Sleep 10000
Loop

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

I can't help you with the PCOMM commands, but try this:

Code: Select all

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

' REM This line calls the macro subroutine
subSub1_

Sub subSub1_()
  Do
    autECLSession.autECLOIA.WaitForAppAvailable
    autECLSession.autECLOIA.WaitForInputReady
    autECLSession.autECLPS.SendKeys "cs ssrch"
    autECLSession.autECLOIA.WaitForInputReady
    autECLSession.autECLPS.SendKeys "[enter]"
    ' Wait for 10 seconds = 10000 milliseconds
    WScript.Sleep 10000
  Loop
End Sub
Best wishes,
Hans

hotpprs
NewLounger
Posts: 5
Joined: 19 Oct 2010, 14:45

Re: Help with repeating command on IBM PCOMM

Post by hotpprs »

Great! Thanks Hans.

That does loop now, but I had to take out the sleep command due to an error saying that variable WScript is undefined.
I guess it's PCOMM that doesn't recognize WScript as a variable?
I guess I can play around with it and find some way for it to wait before the next loop.

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

WScript is available in standard VBScript, but I don't know anything about the specific behavior of PCOMM script.
Best wishes,
Hans

hotpprs
NewLounger
Posts: 5
Joined: 19 Oct 2010, 14:45

Re: Help with repeating command on IBM PCOMM

Post by hotpprs »

Thanks. I'll do some google searches and see if I can find an example of a PCOMM script wait.
At least it works now and it does show the output when something comes into the queue.
This is great being that I have to monitor 2 sessions like this.

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 »

Hi,
Does the following command work for you?

Code: Select all

autECLSession.autECLPS.Wait 10000 'milliseconds - adjust as required
I don't work as closely with PCOMM now as I did, but have spent huge amounts of time getting to grips with automating it previously. Post back if you need help and I'll be happy to assist where I can.
:wales: Nathan :uk:
There's no place like home.....

hotpprs
NewLounger
Posts: 5
Joined: 19 Oct 2010, 14:45

Re: Help with repeating command on IBM PCOMM

Post by hotpprs »

Vegas, thanks. The wait statement you posted works as advertised.
Thanks to you and Hans for saving my index finger and my PF key from wearing out.
The macro is complete now and works fine on both sessions.
How did we all survive before the internet came about?
I never would have had this going, I've been trying to figure it out myself for a while now.

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

I'm glad we've been able to help you (thanks, VegasNath!)

Feel free to come back if you have more questions, or just to hang around.
Best wishes,
Hans

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 »

My pleasure. I remember how mundane my job was prior to learning how to automate PCOMM. That was not an easy task, which I could not have achieved without the help of others in this lounge. :cheers:
: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 »

This forum helped a lot, now I am using the same script.

Now I would like the Loop to stop when the character "NEW" is found in a respective row,line and run an ALARM to alert me a new call have been created in the queue.

Anyone can help please

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

Welcome to Eileen's Lounge!

I hope that VegasNath (or someone else) will be able to help you.
Best wishes,
Hans

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

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

I was reading a few post u did HansV, and you make it look so easy hehe.

Quick question how can I set the cursor to a position?

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

I really hope VegasNath will see this thread. I don't have any experience with PCOMM whatsoever.
Best wishes,
Hans

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

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Mr VegasNath, your expertize is priceless :)
Please come to the rescue.

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

Re: Help with repeating command on IBM PCOMM

Post by HansV »

Today (Sunday) is a day off for most members of Eileen's Lounge, so it's usually very quiet. Tomorrow (Monday), there should be more people online.
Best wishes,
Hans

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

Re: Help with repeating command on IBM PCOMM

Post by moktarious »

Dear Sunday, Please tell Monday to take the day off tomorrow, you can work a double shift :D, Yours Truly, Me.

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 »

Welcome to the lounge!

If you search here or The other place for my started "PCOMM" threads, you may find some useful code.

I can't find (at the minute) anything for physically setting the cursor position, but:

Incase this helps:

To read the text at a certain screen position:

Code: Select all

If pcommPS.GetText(1, 2, 4) = "PROD" Then 'Read row 1, column 2, text length of 4 characters
To write text to a screen coordinate

Code: Select all

pcommPS.SetText Range("A1"), 9, 6 'Writes the text from Range("A1") to row 9, column 6
I'll grab some code from work tomorrow, I don't have anything saved at home any more.

I don't really understand your first question, can you elaborate a little?


Added:
I'm off to see the mother-in-law :help: for good old sunday roast. I should be around later today....
: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 let me elaborate so you can understand what I am talking about. But first of all a million thanks for your help.
After I log in to the session. My cursor is at position 22/028, then I type ci then press enter (that will send me to the local queue, with all service call listed). To refresh the list I need to retype ci/enter again. Now what I want to create is something that look at a certain position after pressing ci/enter to see if a new call appear. The "NEW" should be at line N (05,026) E (05,027), W (05,028). When the new is there, it's mean a new call have been created by the costumer and need to be handled. So instead of staying in front of the pc and keep pressing ci/enter and looking for new call. I wanted to run a macro that keep looking for the string "NEW" when it's appear it will make an alert or some alarm so I can get back in front of the pc, or send an email, anything to tell me there is a new call. Is it more clear sir? Thanks Mr.Moe