home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / keystuff.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-26  |  1.4 KB  |  40 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 343                                          Date: 24 Apr 94  13:09:00
  3. '  From: Saul Ansbacher                               Read: Yes    Replied: No 
  4. '    To: Howard Hull Jr                               Mark:                     
  5. '  Subj: Keyboard buffer stuffer..
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'But you could stuff the keyboard buffer and then exit. You could stuff
  8. 'the name of an exe or com file to run, provided you changed to that
  9. 'drive/directory. If you needed to pass params., then you could creat a
  10. 'batch file (with open, print #, and all that) and then stuff the name of
  11. 'the batch file and run it (it could even delete it self later). Here is
  12. 'some code that will let you stuff 14 chars plus an enter...
  13.  
  14. DEFINT A-Z
  15. DECLARE SUB StuffBuffer (Cmd$)
  16.  
  17. DEFSNG A-Z
  18. SUB StuffBuffer (Cmd$) STATIC
  19.  
  20.     'Limit the string to 14 characters plus Enter
  21.     'and save the length.
  22.  
  23.     Work$ = LEFT$(Cmd$, 14) + CHR$(13)
  24.     Length = LEN(Work$)
  25.  
  26.     'Set the segment for poking, define the buffer
  27.     'head and tail, and then poke each character.
  28.  
  29.     DEF SEG = 0
  30.     POKE 1050, 30
  31.     POKE 1052, 30 + Length * 2
  32.  
  33.     FOR X = 1 TO Length
  34.         POKE 1052 + X * 2, ASC(MID$(Work$, X))
  35.     NEXT X
  36.  
  37.     DEF SEG
  38.  
  39. END SUB
  40.