home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / SCRPTEXM.PAK / DIRTOOL.SPP < prev    next >
Encoding:
Text File  |  1997-05-06  |  1.6 KB  |  52 lines

  1. //--------------------------------------------------------------------------
  2. // Object Scripting
  3. // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
  4. //
  5. // DIRTOOL.SPP: Directory Tool. Creates a new tool called "Directory
  6. //   Listing," which takes a filespec and generates a directory listing
  7. //   in the message window.
  8. //
  9. // USE: Run script to create the tool. Use the tool by choosing
  10. //   Tool | Directory Listing and entering a file mask.
  11. //--------------------------------------------------------------------------
  12. print typeid(module());
  13.  
  14. //
  15. // IDE imports.
  16. //
  17. import IDE;
  18.  
  19. dirtool()
  20. {
  21.   //
  22.   // Create a tool via Options | Tools. Note that keys are pumped into
  23.   // the keyboard buffer prior to invoking the dialog. The second
  24.   // parameter to SendKeys is TRUE to cause processing to wait for
  25.   // the dialog proc.
  26.   //
  27.   IDE.KeyboardManager.SendKeys("%n", TRUE);  // Access New button.
  28.   IDE.KeyboardManager.SendKeys("Directory Listing", TRUE);
  29.   Tab();
  30.   IDE.KeyboardManager.SendKeys("command.com", TRUE);
  31.   Tab();
  32.   declare keys = "$NOSWAP $CAP MSG(FILENAME) /c dir /b $PROMPT $SELNODES";
  33.   IDE.KeyboardManager.SendKeys(keys, TRUE);
  34.   Tab();
  35.   IDE.KeyboardManager.SendKeys("Directory Listing", TRUE);
  36.   Tab();
  37.   keys = "Creates a directory listing in the message window.";
  38.   IDE.KeyboardManager.SendKeys(keys, TRUE);
  39.   IDE.KeyboardManager.SendKeys("{VK_RETURN}", TRUE);  // Close Tool Options.
  40.   IDE.KeyboardManager.SendKeys("%c", TRUE);  // Close Tools using Alt-c.
  41.  
  42.   IDE.OptionsTools();
  43. }
  44.  
  45. //
  46. // Sends a Tab key.
  47. //
  48. Tab()
  49. {
  50.   IDE.KeyboardManager.SendKeys("{VK_TAB}", TRUE);
  51. }
  52.