home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / HAPI.ZIP / HAPI / HAPI_REX / CMMACRO.CMD next >
OS/2 REXX Batch file  |  1991-09-05  |  3KB  |  77 lines

  1. /****************************************************************
  2. * Module Name:  CMMACRO.CMD                                     *
  3. *                                                               *
  4. * Descriptive Name: Rexx EHLLAPI Sample Program                 *
  5. *                                                               *
  6. * Copyright:    (C) Copyright IBM Corp. 1988, 1991              *
  7. *               Licensed Material - Program Property of IBM     *
  8. *               All Rights Reserved                             *
  9. *                                                               *
  10. * Status:       Release 1.0 Modification 0                      *
  11. *                                                               *
  12. * Function:     Record and Playback Host-session keystrokes.    *
  13. *                                                               *
  14. *               This sample program allows the user to 'record' *
  15. *               and 'playback' sequences of keystrokes in the   *
  16. *               host 3270 session.                              *
  17. *                                                               *
  18. * Restrictions: This sample program is provided solely as       *
  19. *               an example of how Rexx may be used to invoke    *
  20. *               Communications Manager EHLLAPI functions.       *
  21. *                                                               *
  22. * Module Type:  IBM Rexx Procedures Language                    *
  23. ****************************************************************/
  24. parse arg session .
  25. if session = "" then session = "A"
  26. start_key = "@rr"; start_key_text = "Ctrl-R"
  27. play_key  = "@rp"; play_key_text  = "Ctrl-P"
  28. done_key  = "@rq"; done_key_text  = "Ctrl-Q"
  29.  
  30. say "Keystroke Macro Facility"
  31. say "The following keys are redefined in" session "session."
  32. say "  Start recording keystrokes   " start_key_text
  33. say "  Stop  recording keystrokes   " start_key_text
  34. say "  Play back recorded keystrokes" play_key_text
  35. say "  Quit                         " done_key_text
  36. say
  37. say "Beeps are made to give audio feedback."
  38. say "  1 beep  - start recording"
  39. say "  2 beeps - stop recording"
  40. say "  3 beeps - quitting"
  41.  
  42. if rxfuncquery("hllapi") then
  43.    call rxfuncadd "hllapi","saahlapi","hllapisrv"
  44.  
  45. rc = hllapi("Set_session_parms","CONPHYS NORESET")
  46. rc = hllapi("Connect",session)
  47. if (rc \= 0) then return rc
  48. rc = hllapi("Start_keystroke_intercept",session,"L")
  49.  
  50. done = 0; record = 0
  51. do while \done
  52.    key = hllapi("Get_key",session)
  53.    select
  54.       when (key = start_key) & record then
  55.          do; warn(2); record = 0; end
  56.       when (key = start_key) & \record then
  57.          do; warn(1); record = 1; string = ""; end
  58.       when (key = play_key) then
  59.          rc = hllapi("Sendkey",string)
  60.       when (key = done_key) then
  61.          do; warn(3); done = 1; end
  62.       when record then
  63.          do; string = string || key; rc = hllapi("Sendkey",key); end
  64.       when \record then
  65.          rc = hllapi("Sendkey",key)
  66.       otherwise nop
  67.    end
  68. end
  69.  
  70. rc = hllapi("Stop_keystroke_intercept",session)
  71. rc = hllapi("Disconnect")
  72. exit
  73.  
  74. warn: procedure
  75.    do arg(1); beep(1000,250); end
  76.    return ""
  77.