home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Bonus / WSTAR2 / DISK4 / COUNT.WM_ / COUNT.bin
Encoding:
Text File  |  1994-02-28  |  11.7 KB  |  164 lines

  1. REM Description:  Count words or sentences
  2. REM Filename: count.wmc
  3. REM Created by: Robin Fried and Steven Wylie - 11/08/93
  4.  
  5. REM Can't run if no document open
  6. IF GetDocName$() = "" THEN
  7.     MESSAGE "Please create a new document or open an existing document first."
  8.     STOP
  9. ENDIF
  10.  
  11. REM Can't run in a graphic or table frame
  12. frameType% = GetFrameType()
  13. IF frameType% <> 0 THEN
  14.     Message "The current frame must be a text frame."
  15.     STOP
  16. ENDIF
  17.  
  18. DIM typeStr$(2)
  19. DIM whereStr$(5)
  20.  
  21. typeStr$(1) = "characters"
  22. typeStr$(2) = "words"
  23.  
  24. whereStr$(1) = "entire document"
  25. whereStr$(2) = "current story"
  26. whereStr$(3) = "current frame"
  27. whereStr$(4) = "current column"
  28. whereStr$(5) = "selected text"
  29.  
  30. sel% = GetTextOffset(start%, end%)
  31.  
  32. IF sel% = 1 THEN where% = 4
  33. type% = 1
  34.  
  35. BEGIN DIALOG Dialog1 134, 110, "Count"
  36.     GROUPBOX       4, 4, 80, 34, "Type:"
  37.     OPTIONGROUP    type%
  38.     OPTIONBUTTON   14, 14, 64, 10, "&Characters"
  39.     OPTIONBUTTON   14, 24, 64, 10, "&Words"
  40.     GROUPBOX       4, 40, 80, 64, "Where:"
  41.     OPTIONGROUP    where%
  42.     OPTIONBUTTON   14, 50, 64, 10, "Entire &Document"
  43.     OPTIONBUTTON   14, 60, 64, 10, "Current Stor&y"
  44.     OPTIONBUTTON   14, 70, 64, 10, "Current &Frame"
  45.     OPTIONBUTTON   14, 80, 64, 10, "Current Co&lumn"
  46.     OPTIONBUTTON   14, 90, 64, 10, "&Selection"
  47.     OKBUTTON       90, 4, 40, 14
  48.     CANCELBUTTON   90, 20, 40, 14
  49. END DIALOG
  50.  
  51. BEGIN DIALOG Dialog2 134, 80, "Count"
  52.     GROUPBOX       4, 4, 80, 34, "Type:"
  53.     OPTIONGROUP    type%
  54.     OPTIONBUTTON   14, 14, 64, 10, "&Characters"
  55.     OPTIONBUTTON   14, 24, 64, 10, "&Words"
  56.     GROUPBOX       4, 40, 80, 34, "Where:"
  57.     OPTIONGROUP    where%
  58.     OPTIONBUTTON   14, 50, 64, 10, "Current Stor&y"
  59.     OPTIONBUTTON   14, 60, 64, 10, "&Selection"
  60.     OKBUTTON       90, 4, 40, 14
  61.     CANCELBUTTON   90, 20, 40, 14
  62. END DIALOG
  63.  
  64. IF GetEditor() = 1 THEN        ' Page Editor
  65.     ret% = Dialog(dialog1)
  66. ELSE
  67.     where% = sel%
  68.     ret% = Dialog(dialog2)        ' Draft Editor
  69.     IF where% = 0 THEN
  70.         where% = 1
  71.     ELSE
  72.         where% = 4
  73.     ENDIF
  74. ENDIF
  75.  
  76. if ret% = 2 THEN STOP
  77.  
  78. if type% = 0 THEN
  79.     count% = CountCharacters(where%)
  80. else
  81.     count% = CountWords(where%)
  82. endif
  83.  
  84. messageText$ = "There are "+str$(count%)+" "+typeStr$(type%+1)+" in the "+whereStr$(where%+1)+"."
  85. Message(messageText$)
  86.  
  87. 
  88. *****  WARNING *****
  89. This is a WSWin macro file.
  90. Subsequent data is binary information and should not be modified.
  91. # MF # 1.0None762570320╕Φ ╡#
  92. 8àêë
  93. âêçèâ
  94. 8ìî
  95. ïìÄÅ
  96. 8    
  97. 8    æÉÆ
  98. 8 âÉöâ
  99. 8ûò
  100. ïûùÿ
  101. 8
  102. 1Ö
  103. 1¢
  104. 82Ç0₧Ö    ₧¥
  105. 82Ü0áÖ    áƒ
  106. 82Ç0ó¢    óí
  107. 82Ü0ñ¢    ñú
  108. 82Ñ0º¢    ºª
  109. 82¿0¬¢    ¬⌐
  110. 82£0¼¢    ¼½
  111. 8 «»░¡▒
  112. 8 
  113. â¡Ç│â
  114. 8 !┤¿
  115. 8!"╡Ç
  116. 3╢╖╕╣4¿¿║╗╝4 ╡4
  117. ╜╜╛┐└4
  118. ╜┴╛┐┬4¿├║╛─4 ┤4
  119. ╜┼╛┐╞4
  120. ╜╟╛┐╚4
  121. ╜╔╛┐╩4
  122. ╜║╛┐╦4
  123. ╜╠╛┐═ 4╠¿├╜ 4    ╠╬├╜
  124. 8"25
  125. 3╧╖║╣4¿¿║╗╝4 ╡4
  126. ╜╜╛┐└4
  127. ╜┴╛┐┬4¿├║╗─4 ┤4
  128. ╜┼╛┐╚4
  129. ╜╟╛┐═ 4╠¿├╜ 4    ╠╬├╜
  130. 82?5
  131. 8?@╨╥╙
  132. â╥Ç╘â
  133. 8@B6╒╢╤
  134. 8BD┤¡
  135. 8DE6╒╧
  136. 8EE
  137. â┤╫â
  138. 8EG┤Ç╓
  139. 8GI┤¿
  140. 8IL
  141. â╒Ü┘â
  142. 8LM
  143. 8MN
  144. â╡█â
  145. 8NP
  146. ▌┤▄▐┌
  147. 8PR
  148. ▀┤▄α
  149. 8RU
  150. π▄τΦ"ΘΓτ"ΩΘΣ∞╡Ç2∞0δÖ"φΩδ"εφσ≡┤Ç2≡0∩¢"±ε∩"≥±µ    ß≥
  151. 8UV    ≤ß
  152. ï≤⌠⌡°~¡$≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈.?N.?N.?N .?N-.?N5.?N;.?NA.?NN.?N^.?N    l.?N
  153. z.?N ê.?N û.?Nñ.?N▓.?N╢.?N╣.?N╜.?N└.?N┬.?N─.?N╞.?N╔.?N╠.?N╧.?N╥.?N╘.?N╓.?N┌.?N▄.?N▐.?Nα.?N Γ.?N!Σ.?N"Θ.?N#∞.?N$≡.?N%⌡.?N&ⁿ.?N'/?N(
  154. /?N)/?N*/?N+/?N,"/?N-(/?N.-/?N/3/?N06/?N1;/?N2@/?N3B/?N4E/?N5J/?N6N/?N7T/?N8Y/?N9`/?N:g/?N;l/?N<o/?N=w/?N>y/?N?{/?N@/?NAê/?NBî/?NCÅ/?NDù/?NE₧/?NFú/?NG¡/?NH┤/?NI╣/?NJ╜/?NK┬/?NL╟/?NM═/?NN╤/?NO╒/?NP▄/?NQπ/?NRΩ/?NS≡/?NT≈/?NU0?NV0?NW0?NX$0?NY10?NZ:0?N[G0?N\P0?N]X0?N^`0?N_h0?N`q0?Nav0?Nb{0?NcÇ0?Ndç0?NeÄ0?Nfö0?Ng¢0?Nh¥0?Nió0?Nj¿0?Nk«0?Nl╡0?Nm╛0?Nn╟0?No╦0?Np╙0?Nq╫0?Nr▄0?NsΓ0?NtΦ0?Nuε0?Nv⌠0?Nw∙0?Nx■0?Ny1?Nz1?N{1?N|1?N}_N  _N+_N+    _N_N_N  _N _N
  155. ë,_N  H1_N+      4_N      9_N     >_N  HC_NçK_N+      Ä_N      ô_N  ÿ_N     ¥_N          ¿_Nç╡_N     ║_N  ÿ┐_N  ÿ─_N+      ε_N      ≤_N  °_N     ■_N
  156.           _N+      _N
  157.           _N+  _N+      "_N      Ö(_N+      0_N      Ö6_N+      H_N      ¢N_N+      ^_N      ¢d_N+  f_N+      v_N      ¢|_N+  ~_N+      Å_N      ¢ò_N+      Ñ_N      ¢½_N          ░_Nç╛_N          ┼_N          ╩_N     ╨_N  ╝╒_N  ╝┌_N          ß_N          τ_N      ∩_N+  å≤_N+  n≈_N+       _N+  P_N+  "_N+      _N+  _N+  @_N+  
  158. _N+      $_N+  '_N+      0_N+  (3_N+      <_N+  2?_N+      R_N+  <U_N+      f_N+  Fi_N+      z_N+      î_N+  ZÅ_N+      £_N+  ƒ_N      º_Nç    ▒_N  ó╢_N  ╝_N     ┬_N  F╟_N          ╠_N  ó╤_N  Æ╫_N  ╞▌_N  ╞π_N  
  159. Θ_N  ÷∩_N          ÷_Nç
  160. _N      _Nç _N     _N
  161.           *_N+      7_N
  162. ë<_N+      @_N+      K_N+      O_N      U_N     [_N      a_N      g_N      Öm_N  s_N      y_N      _N      ¢à_N  ï_N      æ_N      ù_N      ¥_N  ú_N     ⌐_N½_N????01CANCELERRORNUM[T1]
  163. GETDOCNAME$[L1]""[T2][T3][L2]MESSAGE"Please create a new document or open an existing document first."[T4][T5][T6]FRAMETYPE%GETFRAMETYPE[T7][L3][L4]"The current frame must be a text frame."[T8][T9][T10]TYPESTR$2WHERESTR$5"characters"[T11]"words"[T12]"entire document"[T13]"current story"[T14]3"current frame"[T15]4"current column"[T16]"selected text"[T17]SEL%GETTEXTOFFSETSTART%END%[T18][L5][L6]WHERE%TYPE%DIALOG1134110"Count"8034"Type:"146410"&Characters"24"&Words"40"Where:"50"Entire &Document"60"Current Stor&y"70"Current &Frame""Current Co&lumn"90"&Selection"20DIALOG2GETEDITOR[L7][T19][T20][L8]RET%[L9][L10][L11][L12][L13][L14]COUNT%COUNTCHARACTERS[T21]COUNTWORDS[T22]MESSAGETEXT$"There are "STR$" "" in the ""."[T23][T24][T25][T26][T27][T28][T29][T30][T31][T32][T33][T34][T35][T36][T37]
  164.