home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / apmtst.zip / TRAPTRAP.CMD < prev   
OS/2 REXX Batch file  |  1994-09-27  |  3KB  |  67 lines

  1. /****************** IBM Internal Use Only *************************/
  2. /* TRAPTRAP: Process a OS/2 System error box window               */
  3. /*           ---- Sample program demonstrating APMT -----         */
  4. /* Author: Dev Banerjee (IBM Corporation)                         */
  5. /*                                                                */
  6. /* (C) Copyright IBM Corporation 1994. All rights reserved.       */
  7. /*  All rights reserved                                           */
  8. /*                                                                */
  9. /* Function:                                                      */
  10. /* This program loops and every 10 seconds looks at the top most  */
  11. /* window on the desktop. If the top window is a system trap      */
  12. /* window, it brings up  the trap information window, captures    */
  13. /* the information in a bitmap file and dismisses the trap window.*/
  14. /* The bitmap file can later be viewed by a bitmap viewing program*/
  15. /*                                                                */
  16. /* Prereqs:                                                       */
  17. /*                                                                */
  18. /*   APMT rexx function package (OS2EWS)                          */
  19. /******************************************************************/
  20. Trace off
  21. call APMT_INIT
  22. /******************************************************************/
  23. trap_dir = ""; /* other example: trapdir = "d:\trap\"             */
  24. say 'Waiting for a trap to occur...'
  25. do while 1=1
  26.    rc = WAIT(10000)
  27.    rc = SELECT_WINDOW("*")
  28.    rc = QUERY_TITLE("title")
  29.    rc = PUSHBUTTON_QUERY_ALL("pbs")
  30.    rc = RADIOBUTTON_QUERY_ALL("rbs")
  31.    /* A tell-tale sign that we are looking at the system trap window */
  32.    if title = '' & pbs.0 = 2 & pbs.1 = "" & pbs.2 = "" & rbs.0 = 2
  33.       then do
  34.         /* first, display the trap data */
  35.         rc = RADIOBUTTON_CLICK("",2)
  36.         rc = PUSHBUTTON_CLICK("")
  37.         rc = WAIT(2000)
  38.         rc = SELECT_WINDOW("*")
  39.         /* Now get the bitmap image */
  40.         trap_time = time()
  41.         trap_file = translate(trap_time,'_',':')||.bmp
  42.         trap_file = trap_dir||trap_file
  43.         rc = SAVE_IMAGE(trap_file)
  44.         /* dismiss the trap window  */
  45.         rc = RADIOBUTTON_CLICK("",1)
  46.         rc = PUSHBUTTON_CLICK("")
  47.         say 'Trap window dismissed at ' date() trap_time
  48.         say 'Waiting for a trap to occur...'
  49.         end
  50.    end
  51. /******************************************************************/
  52. APMT_CLOSE:
  53. rc = END_SESSION();
  54. exit
  55.  
  56. APMT_INIT:
  57. call rxfuncadd  'APMTLoadFuncs',  'apmtext', 'APMTLoadFuncs'  /* entry points from the DLL    */
  58. call APMTLoadFuncs;
  59. rc = INIT_SESSION();
  60. if rc \= 0
  61.    then do
  62.      say apmtmsg
  63.      signal errorexit
  64.      end
  65. signal on halt name APMT_CLOSE
  66. return
  67.