Sam80
asked on
How to create macro to capture the session screen and beep if condition met?
I would like to create the macro the refresh every several mins to monitor the job status, once "MSGW" appears the macro should know "beep" me.. then I can do other things without monitoring the session all the time. The tech points is that I dont know how to compare the strings in the screen and don't know how to trigger beep in the macro..
Sam
Sam
I've coded the sample to prompt message for message wait job, but I do want to "Beep". anyone know it? the current screen will be on the work job screen, e.g. wrkusrjob xxx *active. then this macro is applied to monitor this screen.. by refreshing every 3 secs, prompts warning ifmessage wait job found.
[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 MsgInd
Dim MsgRow, MsgCol
Dim MsgJob
Dim MsgBody
MsgInd = False
MsgRow = 1
MsgCol = 1
MsgBody = "prompt message"
Do while MsgInd=False
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.Wait(3000)
autECLSession.autECLPS.SendKeys "[pf5]"
MsgInd = autECLSession.autECLPS.SearchText("MSGW",1,MsgRow,MsgCol)
If MsgInd Then
MsgJob = autECLSession.autECLPS.GetText(MsgRow, 7, 10)
Msgbox MsgBody,,"Batch Monitor"
End if
Loop
end sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks murphey2, but can the AS400 session macro support WScript.CreateObject? I've tried before but seems not work, I will try when I back tomorrow.. keep you update..
Hi Sam40,
It is already some day's ago, but I think I copied this example from a working script.
Regards,
It is already some day's ago, but I think I copied this example from a working script.
Regards,
ASKER
I've got the beep statement.. check it out:
Beep = chr(007)
autSystem.shell "cmd.exe", "/c @echo " & Beep,5
Beep = chr(007)
autSystem.shell "cmd.exe", "/c @echo " & Beep,5
Hi Sam,
Good Old Great DOS :)
Have Fun!!
Good Old Great DOS :)
Have Fun!!
I do a similar trick to get the program name, see Snippet.
The Beep... ? I will check, buy I'm wondering if that isn't a MSGBOX function :s
Regards,
Murph
Open in new window