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

  1. REM Description: Manage 'Quick Path' entries
  2. REM Filename: quikpath.wmc
  3. REM Created by: Steve Wylie - 11/08/93
  4.  
  5. DECLARE FUNCTION GetWindowsDirectory LIB "kernel" (lpSysPath AS STRING, nSize As WORD) As WORD
  6.  
  7. CONST Section$ = "Quick Paths"
  8. CONST IniFile$ = "wsw.ini"
  9. CONST MaxEntries% = 64
  10.  
  11. DIM entries$(MaxEntries%)
  12.  
  13. ' Because we need to get all of the INI file entries in the [FileNames] section,
  14. ' we have to read the WSW.INI file directly, instead of using the GetPrivateProfileString
  15. ' statement.  So we have to get the path to the ini file in order to read it.
  16. size% = w2i(GetWindowsDirectory(winPath$, i2w(150)))
  17. IF (right$(winPath$, 1) <> "\") THEN winPath$ = winPath$ + "\"
  18.  
  19. fileName$ = winpath$+IniFile$
  20. sectionName$ = "[" + Section$ + "]"
  21.  
  22. ' Now read the file until we get to the right section.
  23. OPEN fileName$ FOR INPUT AS #1
  24. DO
  25.     LINE INPUT #1, line$
  26. LOOP UNTIL EOF(#1) OR INSTR(line$, sectionName$) > 0
  27.  
  28. IF NOT EOF(#1) THEN
  29.     entry% = 1
  30.     DO
  31.         LINE INPUT #1, tempStr$
  32.         tempStr$ = ltrim$(rtrim$(tempStr$))
  33.         IF (tempStr$ <> "") AND (INSTR(tempStr$, "[") = 0) AND (left$(tempStr$,1) <> ";") AND (right$(tempStr$,1) <> "=") THEN
  34.             entries$(entry%) = tempStr$
  35.             entry% = entry% + 1
  36.         ENDIF
  37.     LOOP UNTIL (INSTR(tempStr$, "[") > 0) OR (EOF(#1)) OR (entry% = MaxEntries%)
  38. ENDIF
  39.  
  40. ' We're done with the file, so we can close it.
  41. CLOSE #1
  42.  
  43. index% = 1
  44.  
  45. BEGIN DIALOG Dialog1 294, 118, "Manage Quick Path Entries"
  46.     TEXT           4, 4, 240, 16, "Choose an &Entry from the list and then choose an action:"
  47.     LISTBOX        4, 14, 240, 100, entries$, index%
  48.     PUSHBUTTON     250,  4, 40, 14, "&Close", 2
  49.     PUSHBUTTON     250, 20, 40, 14, "&Add New", 3
  50.     PUSHBUTTON     250, 36, 40, 14, "&Modify", 4
  51.     PUSHBUTTON     250, 52, 40, 14, "&Delete", 5
  52. END DIALOG
  53.  
  54. start:
  55.  
  56. IF entry% > 1 THEN
  57.     ret% = Dialog(Dialog1)
  58.     IF ret% = 2 THEN STOP
  59.     IF ret% = 1 THEN ret% = 4    'On double-click, choose Modify
  60. ELSE
  61.     ' If there are no entries, then we have to add a new one.
  62.     ret% = 3
  63. ENDIF
  64.  
  65. ' Define the title for the second dialog
  66. title$ = "Add Quick Path Entry"
  67. IF ret% = 4 THEN title$ = "Modify Quick Path Entry"
  68.  
  69. BEGIN DIALOG Dialog2 204, 148, title$
  70.     TEXT           4, 4, 150, 8, "&Entry:"
  71.     TEXTBOX        4, 14, 150, 12, entryText$
  72.     TEXT           4, 28, 150, 8, "Example:  Documents"
  73.     TEXT           4, 42, 150, 8, "&Directory:"
  74.     TEXTBOX        4, 52, 150, 12, directory$
  75.     TEXT           4, 66, 150, 8, "Example:  c:\mydocs"
  76.     TEXT           4, 80, 150, 8, "&File Specification:"
  77.     TEXTBOX        4, 90, 150, 12, fileSpec$
  78.     TEXT           4, 104, 150, 8, "Example:  *.doc"
  79.     OKBUTTON       160, 4, 40, 14
  80.     CANCELBUTTON   160, 20, 40, 14
  81.     TEXT           4, 120, 150, 24, "You can specify more than one file specification, separated by semicolons.  Example:  *.doc;*.txt"
  82. END DIALOG
  83.  
  84.  
  85. SELECT CASE ret%
  86.  
  87.     CASE 3
  88.         ' Add new entry
  89.         ret2% = Dialog(Dialog2)
  90.         ' If user presses Cancel and no entries are in the ini file, then just stop.
  91.         IF ret2% = 2 AND entry% = 1 THEN STOP
  92.         IF ret2% = 1 AND entryText$ <> "" THEN
  93.             fileSpec$ = directory$ + ";" + fileSpec$
  94.             REM Create the new entry in the ini file
  95.             WritePrivateProfileString Section$, entryText$, fileSpec$, IniFile$
  96.             REM And add it to the listbox
  97.             entries$(entry%) = entryText$ + "=" + fileSpec$
  98.             index% = entry%
  99.             entry% = entry% + 1
  100.         ENDIF
  101.         entryText$ = ""
  102.         directory$ = ""
  103.         fileSpec$ = ""
  104.         
  105.     CASE 4
  106.         ' Modify selected entry
  107.         tempStr$ = entries$(index%)
  108.         equal% = INSTR(tempStr$, "=")
  109.         semi% = INSTR(tempStr$, ";")
  110.         entryText$ = left$(tempStr$, equal%-1) 
  111.         oldEntry$ = entryText$
  112.         directory$ = mid$(tempstr$, equal%+1, semi%-(equal%+1))
  113.         fileSpec$ = mid$(tempStr$, semi%+1, len(tempStr$))
  114.         ret2% = Dialog(Dialog2)
  115.         if ret2% = 1 AND entryText$ <> "" THEN
  116.             fileSpec$ = directory$ + ";" + fileSpec$
  117.             REM Remove the old entry, in case the entry name was changed.
  118.             WritePrivateProfileString Section$, oldEntry$, chr$(0), IniFile$
  119.             WritePrivateProfileString Section$, entryText$, fileSpec$, IniFile$
  120.             entries$(index%) = entryText$ + "=" + fileSpec$
  121.         ENDIF
  122.         entryText$ = ""
  123.         directory$ = ""
  124.         fileSpec$ = ""
  125.  
  126.     CASE 5
  127.         ' Delete selected entry
  128.         tempStr$ = entries$(index%)
  129.         equal% = INSTR(tempStr$, "=")
  130.         semi% = INSTR(tempStr$, ";")
  131.         entryText$ = left$(tempStr$, equal%-1) 
  132.         directory$ = mid$(tempStr$, equal%+1, semi%-(equal%+1))
  133.         fileSpec$ = mid$(tempStr$, semi%+1, len(tempStr$))
  134.         ret% = MessageBox(entryText$ + chr$(13) + chr$(13) + "Are you sure you want to delete this entry?", "Delete Entry?", 33)
  135.         IF ret% = 1 THEN
  136.             REM Remove the deleted entry
  137.             IF entryText$ <> "" THEN
  138.                 WritePrivateProfileString Section$, entryText$, chr$(0), IniFile$
  139.             ENDIF
  140.  
  141.             REM Remove the deleted entry from the listbox also, and shuffle the other entries up.
  142.             FOR i% = index% to (MaxEntries% - 1)
  143.                 entries$(index%) = entries$(index%+1)
  144.             NEXT i%
  145.             entries$(MaxEntries%) = ""
  146.             REM Decrease the number of entries
  147.             entry% = entry% - 1
  148.         ENDIF
  149.  
  150. END SELECT
  151.  
  152. GoTo start
  153. 
  154. *****  WARNING *****
  155. This is a WSWin macro file.
  156. Subsequent data is binary information and should not be modified.
  157. # MF # 1.0None762570759v
  158. ª
  159. å5=
  160. 8    ëè
  161. 8        ïî
  162. 1Å@
  163. 8    òö
  164. ôòûù
  165. àÆûÿ
  166. æÿÉÖ
  167. 8$¥Ç ¢Æ¥₧ƒ á₧£âáíâ
  168. 8$"óÆ£    Æó
  169. 8"ñÆï    úñ
  170. 8"¿ªë"⌐¿º    Ñ⌐
  171. 8#úÇ
  172. 8%Ǽ
  173. 8$Ç¡
  174. .«Ç¼Ñ»«â¡»¬â
  175. 8$Ç▒â▒▓â
  176. 8│Ç
  177. 8 %Ç╢
  178. 8 !
  179. ╕╢╣║
  180. ╖╣╗╝    ╢╗
  181. 8!!| ┬╢╛├┬
  182. .─Ç╢ª
  183. ┼─╞┼╟├╞╚Ç ┐╢╚╔╩ ╦╔└╠╦═╟╠╬Ç ¢╢╬╧╨ ╤╧┴╥╤â═╥╙â
  184. 8!|#2│@0╘Å    ╘╢
  185. 8#$││Ç
  186. 8$&
  187. .╒Ç╢ª╓╒╫╓$Ç╪┘╪┌╫┘
  188. █│ì▄█â┌▄┤â
  189. 8&*&Ç
  190. 8*,݀
  191. 3▐▀αß4 ΓΓπΣσ4ΓµπτÅ▌4ΦΓΘµΩδ4Φ∞Θµφε4Φ∩Θµ≡Γ4Φ±Θµ≥≤
  192. 8,55
  193. 858â│Ç÷â
  194. 88:6≈▐
  195. 8::
  196. â≈δ∙â
  197. 8:;
  198. 8;;
  199. â≈Ç√â
  200. 8;<≈Γ⌡
  201. 8<?≈ε
  202. 8?C    ⁿ²
  203. 8CC
  204. â≈Γ â
  205. 8CD    ⁿ
  206. 3ⁿ4 ΓΓö4Γµö4 Γö    4 Γ
  207. ö 4Γ±ö 4 Γö4 Γö4Γö4 Γö 4ΓΘµ 4    ∞Θµ4 Γö
  208. 8DS5
  209. 8SV≈
  210. 8VX
  211. âεâ
  212. 8XZ6
  213. 8Z[&
  214. δ
  215.  │Çâ !â
  216. 8[&\
  217. 8\\,
  218. #Ç $╛â#$%â
  219. 8\,^"& └"'&    '
  220. 8^`(ëï)*
  221. 8`b2│@0+Å",┴"-,    +-
  222. 8bc▌│
  223. 8cd││Ç
  224. 8df    ╛
  225. 8fg     ╛
  226. 8gh    ╛
  227. 8hj
  228. âΓ.â/
  229. 8jl2▌@00Å    ╢0
  230. 8lm
  231. .1Ç╢┴
  232. 8mn
  233. .2Ç╢└
  234. 8no31Ç ┐╢345    4
  235. 8op    6
  236. 8pq81Ç91Ç:9;2:
  237. -7╢8;     7
  238. 8qr>2Ç
  239. <╢?@
  240. -=╢>?    =
  241. 8rs6
  242. 8ss,
  243. BÇ C╛âBCDâ
  244. 8s,u"E └"FE    F
  245. 8uwH
  246. GHIJ(ë6IïKL
  247. 8wx(ëïMN
  248. 8xy2▌@0OÅ"P┴"QP    OQ
  249. 8y{    ╛
  250. 8{|     ╛
  251. 8|}    ╛
  252. 8}
  253. â≤RâS
  254. 8ü2▌@0TÅ    ╢T
  255. 8üé
  256. .1Ç╢┴
  257. 8éâ
  258. .2Ç╢└
  259. 8âäU1Ç ┐╢UVW    V
  260. 8äàY1ÇZ1Ç[Z\2[
  261. -X╢Y\     X
  262. 8àå^2Ç
  263. <╢_`
  264. -]╢^_    ]
  265. 8åçfb
  266. Gfgh"igjb
  267. Gjkl"mik"nmcodpeanop≈q
  268. 8çç
  269. â≈Çsâ
  270. 8çë! â╛uâ
  271. 8ë!ïv
  272. Gvwx(ëwïyz
  273. 8ïÅìÇ|{▌}{{Çâ{|üâ
  274. 8ÅÉ2▌@0éÅä▌Ç2ä@0âÅ    éâ
  275. 8ÉæÇ
  276. 8æÆ2ì@0àÅ    à╛
  277. 8Æö││Ç
  278. 8öÖ⌠ê~Ä|çççççççççççççççççççç... .-.5.;.A.N.^.    l.
  279. z. ê. û.ñ.▓.╢.╣.╜.└.┬.─.╞.╔.╠.╧.╥.╘.╓.┌.▄.▐.α. Γ.!Σ."Θ.#∞.$≡.%⌡.&ⁿ.'/(
  280. /)/*/+/,"/-(/.-//3/06/1;/2@/3B/4E/5J/6N/7T/8Y/9`/:g/;l/<o/=w/>y/?{/@/Aê/Bî/CÅ/Dù/E₧/Fú/G¡/H┤/I╣/J╜/K┬/L╟/M═/N╤/O╒/P▄/Qπ/RΩ/S≡/T≈/U0V0W0X$0Y10Z:0[G0\P0]X0^`0_h0`q0av0b{0cÇ0dç0eÄ0fö0g¢0h¥0ió0j¿0k«0l╡0m╛0n╟0o╦0p╙0q╫0r▄0sΓ0tΦ0uε0v⌠0w∙0x■0y1z1{1|1}╧S  ╧S+╧S+    ╧S╧S╧S  ╧S ╧SàBå4╧S=╧SG╧SM╧S
  281.           V╧S+      d╧S
  282.           m╧S+      w╧S    +P  @â╧S+  @å╧S
  283.           @Å╧S          ò╧SçÖ╧S
  284.           ó╧Sàª╧S+  û¬╧S  »╧S  ┤╧S     ╣╧S  ╛╧S     ├╧S  ó╚╧S
  285. ë╧╧S+      ╙╧S  ╪╧S      ▌╧S     Γ╧S  Φ╧S  óφ╧S      ≤╧S
  286.           ²╧S      ╧S
  287.           ╧S+      ╧S+      ╧S      ╧S      $╧S  ∞)╧S  0.╧S
  288.           4╧S  :╧S  @╧S  F╧S  ªK╧S  Q╧S  ªV╧S          ]╧S  ^b╧S  ªg╧S
  289.           p╧S
  290. ë w╧S
  291. ë
  292. ~╧S      ä╧S     è╧S      É╧S     û╧S  R¢╧S+      ₧╧S
  293. ë*ñ╧S+      ¿╧S+      ¼╧S  ▓╧S  ╕╧S  ╛╧S  ─╧S  ╩╧S  ╨╧S  ╓╧S      ▄╧S     Γ╧S  Φ╧S  ε╧S  ⌠╧S  ·╧S      ╧S     ╧S   ╧S  ╧S  R╧S      Å╧S  $╧S  *╧S  0╧S  6╧S  <╧S  B╧S  H╧S  N╧S          U╧S      ]╧S+  &a╧S+  ve╧S+      ü╧S+  â╧S+  ≡ç╧S+  è╧S+      ╞╧S+  ╔╧S+  d═╧S+  ·╤╧S+  (╘╧S+      ▌╧S+  ▀╧S+  Γ╧S+      φ╧S+  ∩╧S+  $≥╧S+      ⁿ╧S+  4 ╧S+          ╧S+   ╧S86╧S  └╧S  ░╧S          "╧S  ä(╧S  ä.╧S  ¼4╧S  ¼:╧S
  294.           A╧S+      X╧S  °^╧S  °d╧S+      ~╧S      å╧S+  ╠è╧S+  öÄ╧S+  É╧S+      Ü╧S+   ¥╧S
  295.           ¿╧S+  ½╧S+      ┴╧S+  *─╧S+      ╥╧S
  296.           ▌╧S+  Bα╧S+      ÷╧S+  P∙╧S+      ╧S+  Z╧S
  297.           ╧S+  h!╧S+      3╧S+  á7╧S+  x;╧S+  >╧S+      ó╧S  ¿╧S  J
  298. «╧S  ▐┤╧S  ║╧S          └╧S  "╞╧S  ╠╧S  ╥╧S  "╪╧S  ╘▐╧S  Σ╧S  Ω╧S  ╘≡╧S      ÷╧S      ⁿ╧Sç9╧S  ╧S     "╧S      Å(╧S      .╧S      4╧S  $:╧S  
  299. @╧S      ÅF╧S          M╧S          S╧S  Y╧S      _╧S     e╧S
  300.           o╧S      u╧S  {╧S  ü╧S  ç╧S  ì╧Sç-æ╧S      ù╧S  ¥╧S  ú╧S     ⌐╧S  ╠»╧S  ╡╧S  ╗╧S  ╠┴╧S      ╟╧S      ═╧S
  301. ë7╥╧S  ╪╧S      ▐╧S     Σ╧S  Ω╧S     ≡╧S  ÷╧S     ⁿ╧S      Å╧S      ╧S      ╧S  ╧S  J
  302. ╧S      Å ╧S  &╧S      ,╧S     2╧S      8╧S  >╧S  D╧S  J╧S  P╧S      V╧S  \╧S  b╧S     i╧Sç3t╧S+  w╧S+      Ñ╧S+      ╡╧S+  !╕╧S  ┐╧S      ╞╧S     ═╧S      ╘╧S  █╧S      Γ╧S     Θ╧S      ≡╧S      ≈╧S      ■╧S  ╧S      ╧S  J
  303. ╧S  J
  304. ╧S  á    ╧S  á    $╧S  +╧S      2╧S     9╧S  @╧S     G╧S          J╧S  O╧S  ╩    U╧S  ╪    [╧S  b╧S  ┬    h╧S  
  305. n╧S      Åu╧S      Å|╧S  â╧S      Åè╧Sî╧S????01CANCELERRORNUM[T1]
  306. GETWINDOWSDIRECTORY"kernel"LPSYSPATHNSIZESECTION$"Quick Paths"INIFILE$"wsw.ini"MAXENTRIES%64ENTRIES$SIZE%W2IWINPATH$I2W150[T2][T3][T4][T5][T6][L1]RIGHT$"\"[T7][T8][T9][T10][L2][T11]FILENAME$[T12]SECTIONNAME$"[""]"[T13][T14][L3][L4]LINE$[T15][T16][T17][L5][T18][L6]ENTRY%[L7][L8]TEMPSTR$LTRIM$RTRIM$[T19][T20][T21][T22][L9]""LEFT$";""="[T23][T24][T25][T26][T27][T28][T29][T30][T31][T32][T33][T34][T35][T36][T37][T38][T39][L10][T40][T41][T42][T43][T44][T45][T46][T47][T48]INDEX%DIALOG1294118"Manage Quick Path Entries"424016"Choose an &Entry from the list and then choose an action:"1410025040"&Close"220"&Add New"336"&Modify"52"&Delete"5START[L11][L12]RET%[L13][L14][L15][L16]TITLE$"Add Quick Path Entry"[L17][L18]"Modify Quick Path Entry"DIALOG22041488"&Entry:"12ENTRYTEXT$28"Example:  Documents"42"&Directory:"DIRECTORY$66"Example:  c:\mydocs"80"&File Specification:"90FILESPEC$104"Example:  *.doc"16012024"You can specify more than one file specification, separated by semicolons.  Example:  *.doc;*.txt"[T49][L19][L20][L21]RET2%[L22][T50][T51][L23][L24][T52][T53][L25][T54][T55]WRITEPRIVATEPROFILESTRING[T56][T57][T58][T59][T60][L26][L27][T61]EQUAL%SEMI%[T62][T63][T64]OLDENTRY$[T65][T66][T67][T68][T69]LEN[T70][T71][T72][T73][L28][T74][T75][L29][T76][T77]CHR$[T78][T79][T80][T81][T82][T83][T84][T85][T86][T87][L30][L31][T88][T89][T90][T91][T92][T93][T94][T95][T96][T97][T98][T99][T100]MESSAGEBOX13"Are you sure you want to delete this entry?""Delete Entry?"33[T101][T102][T103][T104][T105][T106][T107][T108][T109][T110][T111][T112][L32][L33][L34][L35][T113][T114][T115][T116][T117]I%[F1][L36][L37][T118][L38][L39][T119][T120][T121][T122]
  307.