home *** CD-ROM | disk | FTP | other *** search
/ Program Metropolis - Software Boutique 95 / SOFTWARECD.iso / pct2win / disk5 / notesamp.sc_ / NOTESAMP.SCT
Encoding:
Text File  |  1994-01-12  |  6.0 KB  |  296 lines

  1. ;;;;;;;;;;
  2. ;;    Notepad Demo - NOTESAMP.SCT
  3. ;;    Version 1.0
  4. ;;
  5. ;;    Copyright 1993 Central Point Software, Inc.
  6. ;;
  7. ;;Purpose:
  8. ;;        To demonstrate the use of the Notepad application with ScriptTools
  9. ;;
  10. ;;Commands Used:
  11. ;;        FileExists(
  12. ;;        GetEnvironment$(
  13. ;;        MessageBox(
  14. ;;        TopInstance(
  15. ;;        Attach
  16. ;;        EditText
  17. ;;        Exec
  18. ;;        Exit
  19. ;;        If
  20. ;;        Keyboard
  21. ;;        MenuSelect
  22. ;;        Mouse
  23. ;;        MouseClick
  24. ;;        MouseMove
  25. ;;        Pause
  26. ;;        Type
  27. ;;    
  28. ;;;;;;;;;;
  29.  
  30. WinDir$=GetEnvironment$("windir")
  31. if WinDir$="" then
  32.     MessageBox("Error","Can't find Windows directory.",0)
  33. endif
  34.  
  35. if FileExists(WinDir$+"\setup.txt")=0 then
  36.     MessageBox("Error","This script requires a file called SETUP.TXT in your Windows directory. Exiting now.",0)
  37.     Exit    ;End the script so we don't get unwelcome dialog boxes
  38. endif
  39.  
  40. Exec "Notepad"            ;Run NOTEPAD.EXE
  41. NoteInst=TopInstance()    ;Get instance number of new notepad.exe in case another copy is running
  42. Mouse OFF                ;Temporarily disable user input
  43. Keyboard OFF
  44.  
  45. Attach "NOTEPAD_Edit1",NoteInst
  46.     Type "This script shows how ScriptTools works with Notepad.{Return}"
  47.     pause 2 seconds
  48.  
  49. Attach "NOTEPAD_Notepad",NoteInst
  50. ;;
  51. ;;    Open a new file
  52. ;;
  53.     Wk_New = 9
  54.  
  55. ;     Select "Wk_New" from the File menu
  56.     MenuSelect Wk_New
  57.     pause 2 sec
  58. Attach "NOTEPAD_Notepad",NoteInst
  59.     Wk_No = 7
  60.     Button Wk_No SingleClick
  61.     pause 2 sec
  62. Attach "NOTEPAD_Edit1",NoteInst
  63.     Type "This is a new file.{Return}"
  64.     pause 2 seconds
  65.  
  66. Attach "NOTEPAD_Notepad",NoteInst
  67. ;;
  68. ;;    Open the file setup.txt
  69. ;;
  70.     Wk_Open = 10
  71.  
  72. ;     Select "Wk_Open" from the Menu
  73.     MenuSelect Wk_Open
  74.     pause 2 sec
  75. Attach "NOTEPAD_Notepad",NoteInst
  76.     Wk_No = 7
  77.     Button Wk_No SingleClick
  78.     pause 2 sec
  79. Attach "NOTEPAD_Open",NoteInst
  80.     Wk_setuptxt = 1152
  81.     EditText Wk_setuptxt WinDir$+"\setup.txt"
  82.     pause 1 sec
  83.     Wk_OK = 1
  84.     Button Wk_OK SingleClick
  85.  
  86. Attach "NOTEPAD_Edit1",NoteInst
  87.     Type "{Return}"
  88.     Type "{Up}This is an old file.{Return}"
  89.     Pause 2 Seconds
  90.     Type "{Return}"
  91.  
  92. Attach "NOTEPAD_Notepad",NoteInst
  93. ;;
  94. ;;    Use Save As function
  95. ;;
  96.     Wk_SaveAs = 2
  97.  
  98. ;     Select "Wk_SaveAs" from the Menu
  99.     MenuSelect Wk_SaveAs
  100.  
  101. Attach "NOTEPAD_Save As",NoteInst
  102.     Wk_1152 = 1152
  103.     EditText Wk_1152 WinDir$+"\setup.txt"
  104.     Pause 2 Seconds
  105.     Wk_Cancel = 2
  106.     Button Wk_Cancel SingleClick
  107.  
  108. Attach "NOTEPAD_Edit1",NoteInst
  109.     Type "That was the Save As function.{Return}"
  110.     Pause 2 seconds
  111.     Type "{Return}"
  112.  
  113. Attach "NOTEPAD_Notepad",NoteInst
  114. ;;
  115. ;;    Open Page Setup menu
  116. ;;
  117.     Wk_PageSetup = 32
  118.  
  119. ;     Select "Wk_PageSetup" from the Menu
  120.     MenuSelect Wk_PageSetup
  121.  
  122. Attach "NOTEPAD_Page Setup",NoteInst
  123.     Wk_f = 30
  124.     EditText Wk_f "&f"
  125.     pause 2 seconds
  126.     Wk_OK = 1
  127.     Button Wk_OK SingleClick
  128.  
  129. Attach "NOTEPAD_Edit1",NoteInst
  130.     Type "That was the Page Setup function.{Return}"
  131.     Pause 2 seconds
  132.  
  133. Attach "NOTEPAD_Notepad",NoteInst
  134. ;;
  135. ;;    Open the print setup menu
  136. ;;
  137.     Wk_PrintSetup = 31
  138.  
  139. ;     Select "Wk_PrintSetup" from the Menu
  140.     MenuSelect Wk_PrintSetup
  141.  
  142. Attach "NOTEPAD_Print Setup",NoteInst
  143. pause 2
  144.  
  145.     Wk_Cancel = 2
  146.     Button Wk_Cancel SingleClick
  147.  
  148. Attach "NOTEPAD_Edit1",NoteInst
  149.     Type "{Return}"
  150.     Type "That was the Printer Setup function.{Return}"
  151.     Pause 5 seconds
  152.  
  153. Attach "NOTEPAD_Notepad",NoteInst
  154.     Wk_Exit = 28
  155.  
  156. ;     Select "Wk_Exit" from the Menu
  157.     MenuSelect Wk_Exit
  158.  
  159. Attach "NOTEPAD_Notepad",NoteInst
  160.     Wk_No = 7
  161.     Button Wk_No SingleClick
  162.  
  163.     exec "notepad"
  164.     NoteInst=TopInstance();Get instance number of new notepad.exe
  165.  
  166. Attach "NOTEPAD_Edit1", NoteInst
  167.  
  168. Attach "NOTEPAD_Notepad", NoteInst
  169.     Wk_Open = 10
  170.  
  171. ;     Select "Wk_Open" from the Menu
  172.     MenuSelect Wk_Open
  173.  
  174. Attach "NOTEPAD_Open", NoteInst
  175.     Wk_setuptxt = 1152
  176.     EditText Wk_setuptxt WinDir$+"\setup.txt"
  177.     Wk_OK = 1
  178.     Button Wk_OK SingleClick
  179.  
  180. ;;
  181. ;;    Cut and Paste example
  182. ;;
  183.  
  184. Attach "NOTEPAD_Edit1", NoteInst
  185.     MouseClick Left Button Down At 0, 8
  186.     MouseMove 23 69
  187.     MouseMove 55 109
  188.     MouseMove 103 133
  189.     MouseMove 159 138
  190.     MouseMove 235 147
  191.     MouseMove 301 152
  192.     MouseMove 371 154
  193.     MouseMove 375 153
  194.     MouseMove 391 152
  195.     MouseMove 405 144
  196.     MouseMove 423 134
  197.     MouseMove 426 132
  198.     MouseMove 427 131
  199.     MouseMove 427 130
  200.     MouseMove 427 129
  201.     MouseMove 428 129
  202.     MouseMove 427 129
  203.     MouseMove 427 130
  204.     MouseClick Left Button Up At 427, 130
  205.  
  206. Attach "NOTEPAD_Notepad", NoteInst
  207.     Wk_CopyCtrlC = 769
  208.     MenuSelect Wk_CopyCtrlC
  209.  
  210. Attach "NOTEPAD_Edit1", NoteInst
  211.     Type "{Return}"
  212.     Type "{Return}"
  213.  
  214. Attach "NOTEPAD_Notepad", NoteInst
  215.     Wk_PasteCtrlV = 770
  216.  
  217. ;     Select "Wk_PasteCtrlV" from the Menu
  218.     MenuSelect Wk_PasteCtrlV
  219.  
  220. Attach "NOTEPAD_Edit1", NoteInst
  221.     Type "{Return}"
  222.     Type "That was copy and paste.{Return}"
  223.     pause 2 seconds
  224.  
  225. Attach "NOTEPAD_Notepad", NoteInst
  226. ;;
  227. ;;    Find Function
  228. ;;
  229.     Wk_Find = 3
  230.  
  231. ;     Select "Wk_Find" from the Menu
  232.     MenuSelect Wk_Find
  233. Pause 2
  234. Attach "NOTEPAD_Find", NoteInst
  235.     Wk_document = 1152
  236.     EditText Wk_document "screen"
  237. Pause 1
  238.     Wk_FindNext = 1
  239.     Button Wk_FindNext SingleClick
  240. Pause 1
  241.     Wk_Cancel = 2
  242.     Button Wk_Cancel SingleClick
  243.  
  244. Attach "NOTEPAD_Edit1", NoteInst
  245.  
  246. Attach "NOTEPAD_Notepad", NoteInst
  247.     Wk_FindNextF3 = 8
  248.  
  249. ;     Select "Wk_FindNextF3" from the Menu
  250.     MenuSelect Wk_FindNextF3
  251.  
  252. Attach "NOTEPAD_Edit1", NoteInst
  253.     Type "{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}{F3}"
  254.  
  255. Attach "NOTEPAD_Notepad", NoteInst
  256.     Wk_OK = 2
  257.     Button Wk_OK SingleClick
  258.  
  259. Attach "NOTEPAD_Edit1", NoteInst
  260. type"{Ctrl}{Home}That was the Find function.{Return}"
  261. Pause 2
  262.  
  263. Attach "NOTEPAD_Notepad", NoteInst
  264. ;;
  265. ;;    Open About menu
  266. ;;
  267.  
  268.     Wk_AboutNotepad = 11
  269.  
  270. ;     Select "Wk_AboutNotepad" from the Menu
  271.     MenuSelect Wk_AboutNotepad
  272.     Pause 2 seconds
  273.  
  274. Attach "NOTEPAD_About Notepad", NoteInst
  275.     Wk_OK = 1
  276.     Button Wk_OK SingleClick
  277.  
  278. Attach "NOTEPAD_Edit1", NoteInst
  279. Type "That was the About Notepad dialog box.{Return}{Return}"
  280. Pause 2
  281. Type "I hope you enjoyed the show. {Return}{Return}Goodbye for now."
  282. ;;
  283. ;;    Exit from Notepad, then end the script
  284. ;;
  285. Attach "NOTEPAD_Notepad", NoteTest
  286.     Wk_Exit = 28
  287.  
  288. ;     Select "Wk_Exit" from the Menu
  289.     MenuSelect Wk_Exit
  290.  
  291. Attach "NOTEPAD_Notepad", NoteTest
  292.     Wk_No = 7
  293.     Button Wk_No SingleClick
  294.  
  295. Mouse ON
  296. Keyboard ON