Groups search result 17 for apmt os/2 |
Sandi Kaczmarczyk (kaczmars@gunet.georgetown.edu) wrote:
: I'm not sure this is an appropriate question for the group. . .
: I am running GroupWise 4.1 message servers for OS\2 on OS\2 2.1. The
: message servers display mail statistics, but do not save the statistic
: information to a file. When you close and restart the process, the
: information is lost.
: I would like to capture the info hourly for a 24x7 period. I have looked
: at the on-line help for OS\2 commands and have also flipped through a
: REXX manual trying to figure out how to get OS\2 to execute a command.
: Basically, I want to feed it the print screen keystroke and have it print
: the screen.
: Does anyone know how to do this? Thanks for your help!
Sure, I've written if for you:
Looking at os2prt.cmd, I've written this printwin.cmd for you.
(don't worry, no hassle, I need rexx practice)
(A limitation, the window this program prints must be the
window in the foreground! Also, I'd suggest you try to run
printwin.cmd via detach or start somehow so it's in the
background. The big problem is that the window you clip
from must be the window of "focus", ie in foreground or on
top of all the other windows...I don't know how to get rexx
to clip a window no matter what...)
To get a certain 'absolute' time you will need to try a kind
of polling method, this is actually what printwin does.
Take a look at how printwin.cmd is written, there is a slight
problem. There will be a very small time error in that since
the program does take a tiny but measureable time to run, that
3600 secs will actually cause the program to 'walk' forward in time
since syssleep(3600) can't instantly start up again. This would
only be detectable if you'd run it for many days since the overhead of
a couple seconds is only added once per hour.
********* WARNING, users of ManyClip EWS Enhanced Clipboard,
do not use this with ManyClip set to Append mode, your output
file will fill up with useless repeat text from old 'clips',
it's is safe to use in "fixed" mode.
(remember, the first line of the rexx program must start with a
slash and * as the first line and first/second characters
==================== cut here ===========*/
/* printwin.cmd */
/* author Mark Schlegel 10/21/95 */
/* schlegel@crocker.com */
trace on
signal on error name ERROREXIT
signal on halt name APMT_CLOSE /* quit graceful via cntr+C by user */
/* you must have loaded the APMT files to a directory */
/* that's on the LIBPATH for this to run */
if RxFuncQuery("APMTLoadFuncs") then do /* only load not loaded*/
call RxFuncAdd "APMTLoadFuncs", 'apmtext', "APMTLoadFuncs"
call APMTLoadFuncs;
end
/* load rexxutil if not loaded */
if RxFuncQuery("SysLoadFuncs") then do
call RxFuncAdd "SysLoadFuncs", "REXXUTIL", "SysLoadFuncs"
call SysLoadFuncs
end
outfile = "f:\your_outfile" /* <--- name your outfile */
/* if you want a certain absolute time, then set a flag
here called first to 1, mins_of_hour to mins after the
hour to run */
first = 1 /* start with first flag to yes */
mins_of_hour = 25 /* <--- set your minute of the hour to run */
rc = INIT_SESSION()
if rc \= 0 then
do
call lineout outfile,apmtmsg /* write an educational
error msg to file */
signal ERROREXIT /* quit */
end
/* there are 'say' statements in the below, they only
run the first loop but you can remove them once running well*/
do forever
if first then /* first time thru */
do
time_now = time("L")
first_colon = verify(time_now,":","match")
curr_min = substr(time_now, first_colon + 1, 2)
say 'current mins after hour is:' curr_min
curr_sec = substr(time_now, first_colon + 4, 2)
say 'current secs after the minute is:' curr_sec
setup_delay = mins_of_hour - curr_min
if setup_delay < 0 then duration = 60*(60 + setup_delay) - curr_sec
else duration = 60*setup_delay - curr_sec
say "time will run out in" duration "seconds"
say "time now is:" time("L")
say "program set to copy window at" mins_of_hour "mins after the hour"
first = 0 /* set first flag to NO */
end
call syssleep(duration) /* wait one hour or whatever for first time */
duration = 3600 /* set to one hour from then on */
call stream outfile, "c","open write"
rc = SELECT_WINDOW("*")
rc = SET_FOCUS()
rc = SYSMENU_SELECT("Copy All") /* copy to clipboard */
if rc > 0 then /* error, Copy All was not an available menu item*/
do
call lineout outfile,"error occurred at" time() "and date" date()
call lineout outfile," " /* put a space gap for next screen */
rc = END_SESSION()
call APMT_CLOSE
end
else /* no error with sysmenu_select, continue */
do
if QUERY_CLIPBOARD_TEXT("clip") = 0 then
do i = 1 to clip.0
call lineout outfile, clip.i /* put the text to the file */
end
call stream outfile,"c","close" /* close file, not good to ...*/
end /* .. leave it open for an hour */
end /* do-forever */
exit
/* end session */
APMT_CLOSE: /* likely called if cntl+c hit to abort program */
rc = END_SESSION()
call ERROREXIT /* call errorexit to free apmt from ram */
ERROREXIT: /* deregister APMT...save memory */
call APMTDropFuncs
call RxFuncDrop("APMTDropFuncs")
exit
/*========= end cut here ========*/
©2002 Google