home *** CD-ROM | disk | FTP | other *** search
- ;;;;;;;;;;
- ;; Write Demo - WRITSAMP.SCT
- ;; Version 1.0
- ;;
- ;; Copyright 1993 Central Point Software, Inc.
- ;;
- ;;Purpose:
- ;; To demonstrate the use of the Write application with ScriptTools
- ;;
- ;;Commands Used:
- ;; Messagebox(
- ;; Running(
- ;; Attach
- ;; ComboBox
- ;; ComboText
- ;; Exec
- ;; Exit
- ;; If
- ;; MenuSelect
- ;; Pause
- ;; ScrollBar
- ;; SysMenuSelect
- ;;
- ;;;;;;;;;;
-
- if Running("write.exe")=1
- Messagebox("Error","Please close the Write application before running this script.",0)
- Exit
- endif
-
- Exec "Write" ;Load the Write application
- Attach "WRITE_Write"
- SysMenuSelect -4048
- Attach "WRITE_MSWRITE_DOC1"
- Type "This script is an example of how ScriptTools works with Write.{Return}{Return}{Return}"
- Pause 1
- type "We'll choose the Fonts command and look at the available fonts.{Return}{Return}"
- pause 1 sec
-
- Attach "WRITE_Write"
- MenuSelect 4168 ;Select the fonts menu item
- Pause 1 sec
-
- ;Get the text from the combo boxes in the Font dialog box.
- ;Usually you don't need to attach to them first but it doesn't hurt.
- Attach "WRITE_ComboLBox1"
- A$=Capture$("WRITE_ComboLBox1",1,1)
- Pause 1 sec
-
- Attach "WRITE_Font"
- Button 2 SingleClick ;Click the Cancel button
- attach "WRITE_MSWRITE_DOC1"
- if a$!="" then
- Type "The fonts I saw were:{Return}{Return}"
- type_special(a$) ;This is a special type routine to handle CRLF correctly.
- Type "We'll choose a font.{Return}{Return}"
- pause 1 sec
- endif
-
- Attach "WRITE_Write"
- MenuSelect 4168 ;Select the Fonts menu item
- pause 1 sec
-
- if a$="" then ;If we get here, we found no fonts installed.
- Attach "WRITE_Font"
- Button 2 SingleClick ;Click the Cancel button
- attach "WRITE_MSWRITE_DOC1"
- Type "I can't display any other fonts because I didn't find any in the Fonts dialog box.{Return}"
- else
- pos=instr(a$,chr$(13)) ;If there is more than 1 font, just use the first.
- if pos!=-1 then
- font$ = Left$(a$,pos) ;Grab the first one in the return-delimited list
- else
- font$=a$ ;Just copy if only one font in the list
- endif
- Attach "WRITE_Font"
- ComboText 1136 font$ ;I got the 1136 number from the Attach Name dialog
-
- B$=Capture$("WRITE_ComboLBox2",1,1)
- C$=Capture$("WRITE_ComboLBox3",1,1)
-
- Attach "WRITE_Font"
- Button 1 SingleClick ;Click the OK button
-
- Attach "WRITE_MSWRITE_DOC1"
- Type "{Return}This is the "+font$+" font.{Return}{Return}"
- if b$!="" then
- Type "The styles I saw for this font were:{Return}{Return}"
- type_special(b$) ;This is a special type routine
- endif
-
- if c$!="" then
- Type "{Return}The point sizes I saw for this font were:{Return}{Return}"
- type_special(c$) ;Special type routine again
- endif
- endif
-
-
-
- Attach "WRITE_MSWRITE_DOC1"
- Type "ScriptTools can launch help by choosing Contents from the Help menu.{Return}"
- Pause 1
- Attach "WRITE_Write"
- MenuSelect 4608
- Pause 5
- Attach "WINHELP_Write Help1"
- MenuSelect 1105
- Attach "WRITE_MSWRITE_DOC1"
- Type "{Return}{Return}"
- Type "Thanks for using this script.{Return}"
- Type "Good-bye for now."
- Pause 1
- Attach "WRITE_Write"
- MenuSelect 4104
- Attach "WRITE_Write"
- Button 7 SingleClick ;Click No when asked to save
-
-
- Function Type_Special(string$)
- ;This routine types the string in the Attached window.
- ;This will be a little different than just using the Type command because
- ;we will be looking for CHR$(13) and then typing "{Return}" in its place.
-
- local x
- if length(string$)!=0
- x=0
- while x<length(string$)
- if substr$(string$,x,x)!=chr$(13)
- type substr$(string$,x,x)
- else
- type "{Return}"
- endif
- x=x+1
- endwhile
- endif
- type "{Return}"
- EndFunction
-