home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / science / scicitat.sit / Scientific Citation Finder / background_2793.txt < prev    next >
Encoding:
Text File  |  1992-05-22  |  14.7 KB  |  548 lines

  1. -- background: 2793 from stack: in
  2. -- bmap block id: 3217
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: The Only Bkgnd
  6. ----- HyperTalk script -----
  7. on openBkgnd
  8.   hide bkgnd button "Find Citations"
  9.   show field "Hider"
  10.   show field "Description"
  11.   show bkgnd button id 18
  12.   show bkgnd button "Go to Word"
  13.   show bkgnd button "Quit"
  14.   pass openBkgnd
  15. end openBkgnd
  16.  
  17.  
  18. -- part 3 (field)
  19. -- low flags: 01
  20. -- high flags: 0007
  21. -- rect: left=154 top=44 right=178 bottom=508
  22. -- title width / last selected line: 0
  23. -- icon id / first selected line: 0 / 0
  24. -- text alignment: 0
  25. -- font id: 3
  26. -- text size: 9
  27. -- style flags: 0
  28. -- line height: 12
  29. -- part name: TestStrings
  30.  
  31.  
  32. -- part 4 (field)
  33. -- low flags: 00
  34. -- high flags: 2004
  35. -- rect: left=36 top=226 right=250 bottom=478
  36. -- title width / last selected line: 0
  37. -- icon id / first selected line: 0 / 0
  38. -- text alignment: 0
  39. -- font id: 0
  40. -- text size: 12
  41. -- style flags: 0
  42. -- line height: 16
  43. -- part name: Citation
  44.  
  45.  
  46. -- part 5 (field)
  47. -- low flags: 01
  48. -- high flags: 0000
  49. -- rect: left=108 top=204 right=221 bottom=398
  50. -- title width / last selected line: 0
  51. -- icon id / first selected line: 0 / 0
  52. -- text alignment: 1
  53. -- font id: 3
  54. -- text size: 12
  55. -- style flags: 256
  56. -- line height: 16
  57. -- part name: Header
  58.  
  59.  
  60. -- part 8 (button)
  61. -- low flags: 00
  62. -- high flags: A003
  63. -- rect: left=42 top=269 right=300 bottom=170
  64. -- title width / last selected line: 0
  65. -- icon id / first selected line: 0 / 0
  66. -- text alignment: 1
  67. -- font id: 0
  68. -- text size: 12
  69. -- style flags: 0
  70. -- line height: 16
  71. -- part name: Delete First Word
  72. ----- HyperTalk script -----
  73. on mouseUp
  74.   set cursor to 4
  75.   set lockScreen to true
  76.   delete word 1 of field "Citation"
  77.   repeat until char 1 of field "Citation" <> " " and char 1 of field "Citation" <> "(" and char 1 of field "Citation" <> tab and char 1 of field "Citation" <> return
  78.     delete char 1 of field "Citation"
  79.   end repeat
  80. end mouseUp
  81.  
  82.  
  83.  
  84. -- part 10 (button)
  85. -- low flags: 00
  86. -- high flags: A003
  87. -- rect: left=209 top=258 right=309 bottom=328
  88. -- title width / last selected line: 0
  89. -- icon id / first selected line: 0 / 0
  90. -- text alignment: 1
  91. -- font id: 0
  92. -- text size: 12
  93. -- style flags: 0
  94. -- line height: 16
  95. -- part name: Save Citation
  96. ----- HyperTalk script -----
  97. on mouseUp
  98.   global infnamesh
  99.   set cursor to 4
  100.   put field "Citation" & return after field "Final Citations"
  101.   click at 500,160
  102.   put empty into field "Citation"
  103.   delete line 1 of field "TestStrings"
  104.   get line 1 of field "TestStrings"
  105.   if it is not empty then
  106.     put line 1 of field "TestStrings" into field "Citation"
  107.     exit mouseUp
  108.   else
  109.     hide btn id 11
  110.     show field "Hider"
  111.     put empty into field "Citation"
  112.     put "Sorting citation list..."
  113.     set cursor to 4
  114.     put SortField(fld "Final Citations") into field "Final Citations"
  115.     set scroll of field "Final Citations" to 0
  116.     hide message
  117.     answer "Do you want duplicate citations removed?" with "Yes" or "No"
  118.     if it = "Yes" then
  119.       put "Removing duplicates..."
  120.       repeat with i=1 to 100000
  121.         set cursor to busy
  122.         repeat until line i of field "Final Citations" <> line i+1 of field "Final Citations"
  123.           delete line i+1 of field "Final Citations"
  124.         end repeat
  125.         if line i+1 of field "Final Citations" is empty then exit repeat
  126.       end repeat
  127.       hide message
  128.     end if
  129.  
  130.     put item 1 of the topLeft of cd window into lft
  131.     put item 2 of the topLeft of cd window into tp
  132.     put infnamesh & ".CIT" into outfnamesh
  133.     put IOQuery(lft,tp,"o","Save citations to file:",outfnamesh) into filout
  134.     if filout = "Error" or filout = "cancel" then     --EXIT IF FILE ERROR
  135.       if filout = "Error" then
  136.         beep
  137.         answer "Encountered error in creating file"
  138.       end if
  139.       show btn id 11
  140.       hide fld "Hider"
  141.       exit mouseUp
  142.     end if
  143.  
  144.     open file filout
  145.     write "Citation list for text file " & infnamesh & ":" & return & return & field "Final Citations" to file filout
  146.     close file filout
  147.  
  148.     hide field "Final Citations"
  149.     put empty into field "Current File"
  150.     hide field "Current File"
  151.     show field "Description"
  152.     show bkgnd button id 18
  153.     show bkgnd button "Go to Word"
  154.     show bkgnd button "Quit"
  155.     put "POSSIBLE CITATIONS" into field "Header2"
  156.   end if
  157. end mouseUp
  158.  
  159.  
  160.  
  161. -- part 13 (button)
  162. -- low flags: 00
  163. -- high flags: A003
  164. -- rect: left=354 top=257 right=308 bottom=470
  165. -- title width / last selected line: 0
  166. -- icon id / first selected line: 0 / 0
  167. -- text alignment: 1
  168. -- font id: 0
  169. -- text size: 12
  170. -- style flags: 0
  171. -- line height: 16
  172. -- part name: Ignore
  173. ----- HyperTalk script -----
  174. on mouseUp
  175.   set cursor to 4
  176.   delete line 1 of field "TestStrings"
  177.   get line 1 of field "TestStrings"
  178.   if it is not empty then
  179.     put line 1 of field "TestStrings" into field "Citation"
  180.     exit mouseUp
  181.   else
  182.     global infnamesh
  183.     hide btn id 11
  184.     show field "Hider"
  185.     put empty into field "Citation"
  186.     put "Now sorting citation list..."
  187.     set cursor to 4
  188.     put SortField(fld "Final Citations") into field "Final Citations"
  189.     set scroll of field "Final Citations" to 0
  190.     hide message
  191.     answer "Do you want duplicate citations removed?" with "Yes" or "No"
  192.     if it = "Yes" then
  193.       repeat with i=1 to 100000
  194.         set cursor to busy
  195.         repeat until line i of field "Final Citations" <> line i+1 of field "Final Citations"
  196.           delete line i+1 of field "Final Citations"
  197.         end repeat
  198.         if line i+1 of field "Final Citations" is empty then exit repeat
  199.       end repeat
  200.     end if
  201.  
  202.     put item 1 of the topLeft of cd window into lft
  203.     put item 2 of the topLeft of cd window into tp
  204.     put infnamesh & ".CIT" into outfnamesh
  205.     put IOQuery(lft,tp,"o","Save citations to file:",outfnamesh) into filout
  206.     if filout = "Error" or filout = "cancel" then     --EXIT IF FILE ERROR
  207.       if filout = "Error" then
  208.         beep
  209.         answer "Encountered error in creating file"
  210.       end if
  211.       show btn id 11
  212.       hide fld "Hider"
  213.       exit mouseUp
  214.     end if
  215.  
  216.     open file filout
  217.     write "Citation list for text file " & infnamesh & ":" & return & return & field "Final Citations" to file filout
  218.     close file filout
  219.  
  220.     hide field "Final Citations"
  221.     put empty into field "Current File"
  222.     hide field "Current File"
  223.     show field "Description"
  224.     show bkgnd button id 18
  225.     show bkgnd button "Go to Word"
  226.     show bkgnd button "Quit"
  227.     put "POSSIBLE CITATIONS" into field "Header2"
  228.   end if
  229. end mouseUp
  230.  
  231.  
  232.  
  233. -- part 6 (field)
  234. -- low flags: 81
  235. -- high flags: 2001
  236. -- rect: left=9 top=189 right=334 bottom=503
  237. -- title width / last selected line: 0
  238. -- icon id / first selected line: 0 / 0
  239. -- text alignment: 0
  240. -- font id: 0
  241. -- text size: 12
  242. -- style flags: 0
  243. -- line height: 16
  244. -- part name: Insts
  245.  
  246.  
  247. -- part 7 (button)
  248. -- low flags: 80
  249. -- high flags: A003
  250. -- rect: left=399 top=311 right=333 bottom=499
  251. -- title width / last selected line: 0
  252. -- icon id / first selected line: 0 / 0
  253. -- text alignment: 1
  254. -- font id: 0
  255. -- text size: 12
  256. -- style flags: 0
  257. -- line height: 16
  258. -- part name: Continue
  259. ----- HyperTalk script -----
  260. on mouseUp
  261.   hide bkgnd button "Continue"
  262.   hide btn id 10
  263.   hide field "Insts"
  264.   show bkgnd button "Delete First Word"
  265.   show bkgnd button "Save Citation"
  266.   show bkgnd button "Ignore"
  267.   show btn id 11
  268.   put empty into field "Final Citations"
  269.   put "CITATION LIST" into field "Header2"
  270.   show field "Final Citations"
  271. end mouseUp
  272.  
  273.  
  274.  
  275. -- part 11 (field)
  276. -- low flags: 80
  277. -- high flags: 0007
  278. -- rect: left=154 top=43 right=178 bottom=509
  279. -- title width / last selected line: 0
  280. -- icon id / first selected line: 0 / 0
  281. -- text alignment: 0
  282. -- font id: 0
  283. -- text size: 12
  284. -- style flags: 0
  285. -- line height: 16
  286. -- part name: Final Citations
  287.  
  288.  
  289. -- part 12 (field)
  290. -- low flags: 01
  291. -- high flags: 0002
  292. -- rect: left=238 top=24 right=41 bottom=401
  293. -- title width / last selected line: 0
  294. -- icon id / first selected line: 0 / 0
  295. -- text alignment: 1
  296. -- font id: 3
  297. -- text size: 12
  298. -- style flags: 256
  299. -- line height: 16
  300. -- part name: HEADER2
  301.  
  302.  
  303. -- part 15 (field)
  304. -- low flags: 01
  305. -- high flags: 0001
  306. -- rect: left=10 top=190 right=333 bottom=503
  307. -- title width / last selected line: 0
  308. -- icon id / first selected line: 0 / 0
  309. -- text alignment: 0
  310. -- font id: 0
  311. -- text size: 12
  312. -- style flags: 0
  313. -- line height: 16
  314. -- part name: Hider
  315.  
  316.  
  317. -- part 16 (field)
  318. -- low flags: 01
  319. -- high flags: 2001
  320. -- rect: left=10 top=189 right=333 bottom=503
  321. -- title width / last selected line: 0
  322. -- icon id / first selected line: 0 / 0
  323. -- text alignment: 1
  324. -- font id: 0
  325. -- text size: 12
  326. -- style flags: 0
  327. -- line height: 16
  328. -- part name: Description
  329.  
  330.  
  331. -- part 17 (button)
  332. -- low flags: 00
  333. -- high flags: A003
  334. -- rect: left=14 top=309 right=331 bottom=114
  335. -- title width / last selected line: 0
  336. -- icon id / first selected line: 0 / 0
  337. -- text alignment: 1
  338. -- font id: 0
  339. -- text size: 12
  340. -- style flags: 0
  341. -- line height: 16
  342. -- part name: Go to Word
  343. ----- HyperTalk script -----
  344. on mouseUp
  345.   open "Microsoft Word"
  346. end mouseUp
  347.  
  348.  
  349.  
  350. -- part 18 (button)
  351. -- low flags: 00
  352. -- high flags: A003
  353. -- rect: left=208 top=309 right=331 bottom=308
  354. -- title width / last selected line: 0
  355. -- icon id / first selected line: 0 / 0
  356. -- text alignment: 1
  357. -- font id: 0
  358. -- text size: 12
  359. -- style flags: 0
  360. -- line height: 16
  361. -- part name: Continue
  362. ----- HyperTalk script -----
  363. on mouseUp
  364.   global infnamesh
  365.  
  366.   put item 1 of the topLeft of cd window into lft
  367.   put item 2 of the topLeft of cd window into tp
  368.   put IOQuery(lft,tp,"i") into infname
  369.   if infname = "Error" or infname = "cancel" then
  370.     if infname = "Error" then
  371.       beep
  372.       answer "Encountered error in locating/reading file"
  373.     end if
  374.     hide MenuBar
  375.     exit mouseUp
  376.   end if
  377.   put GetFileName(infname,"") into infnamesh
  378.  
  379.   set cursor to 4
  380.   go cd "Program Card"
  381.   hide bkgnd button id 18
  382.   hide bkgnd button "Go to Word"
  383.   hide bkgnd button "Quit"
  384.   hide field "Description"
  385.   put "CURRENT FILE:" & return & infnamesh into field "Current File"
  386.   put "Searching for possible citations... this may take a while"
  387.   open file infname
  388.   click at 500,63
  389.   put empty into field "TestStrings"
  390.   put empty into oldline
  391.   put 0 into blline
  392.   put empty into thestring
  393.   read from file infname until return
  394.   put it into theline
  395.   put the number of words in theline into numwords
  396.   put 0 into oldlasti
  397.   put 0 into skipnext
  398.   put -1 into oldnumwds
  399.   repeat until blline > 15
  400.     set cursor to busy
  401.     put 0 into lasti
  402.     if numwords < 2 and offset("1",theline) = 0 then
  403.       add 1 to blline
  404.       read from file infname until return
  405.       put it into theline
  406.       put the number of words in theline into numwords
  407.       next repeat
  408.     else
  409.       put 0 into blline
  410.     end if
  411.     if offset("1",theline) <> 0 then
  412.       repeat with i = 1 to numwords
  413.         put word i of theline into theword
  414.         if char 1 of theword <> "1" and char 1 of theword <> "(" then next repeat
  415.         if the number of chars in theword < 4 then next repeat
  416.         if chartonum(char 3 of theword) > 57 or chartonum(char 3 of theword) < 48 then next repeat
  417.         put getdate(theword) into thedate
  418.         if oldlasti = oldnumwds and i = 1 then
  419.           put thestring && thedate & return after field "TestStrings"
  420.           click at 500,160
  421.         else
  422.           if i <> 1 and i = lasti+1 then
  423.             put thestring && thedate & return after field "TestStrings"
  424.             click at 500,160
  425.           else
  426.             put empty into thestring
  427.             if i > 7 then  -- IF MORE THAN 7 PREV WORDS IN THE LINE...
  428.               put i-1 into begloop
  429.               put i-6 into endloop
  430.               if endloop < lasti then
  431.                 put lasti+1 into endloop
  432.               end if
  433.               repeat with j = begloop down to endloop
  434.                 put " " & word j of theline before thestring
  435.               end repeat
  436.             else
  437.               if i > 1 then
  438.                 put i-1 into begloop
  439.                 put 1 into endloop
  440.                 if endloop <= lasti then
  441.                   put lasti+1 into endloop
  442.                   put 1 into skipnext
  443.                 end if
  444.                 repeat with j = begloop down to endloop
  445.                   put " " & word j of theline before thestring
  446.                 end repeat
  447.               end if
  448.               if skipnext < 1 and oldlasti <> oldnumwds and oldnumwds <> -1 then
  449.                 put oldnumwds into begloop
  450.                 if oldnumwds-(7-i) > -1 then
  451.                   put oldnumwds-(7-i) into endloop
  452.                 else
  453.                   put 1 into endloop
  454.                 end if
  455.                 if endloop < oldlasti and oldlasti < oldnumwds-1 then
  456.                   put oldlasti+1 into endloop
  457.                 end if
  458.                 repeat with j = begloop down to endloop
  459.                   put " " & word j of oldline before thestring
  460.                 end repeat
  461.               end if
  462.             end if
  463.             put thestring && thedate & return after field "TestStrings"
  464.             click at 500,160
  465.           end if
  466.         end if
  467.         put 0 into skipnext
  468.         put i into lasti
  469.       end repeat
  470.       put lasti into oldlasti
  471.     else
  472.       put 1 into oldlasti
  473.     end if
  474.     put theline into oldline
  475.     put numwords into oldnumwds
  476.     read from file infname until return
  477.     put it into theline
  478.     put the number of words in theline into numwords
  479.   end repeat
  480.   close file infname
  481.   if field "TestStrings" is empty then
  482.     answer "No citations found in " & infname with "OK"
  483.     show field "Description"
  484.     show bkgnd button id 18
  485.     show bkgnd button "Go to Word"
  486.     show bkgnd button "Quit"
  487.     put empty into field "Current File"
  488.     hide field "Current File"
  489.     hide message
  490.     exit mouseup
  491.   end if
  492.  
  493.   put "Pre-editing citations..."
  494.   put "*$%@# " & return after fld TestStrings
  495.   repeat until word 1 of fld TestStrings = "*$%@#"
  496.     set cursor to busy
  497.     put getcit(line 1 of field "TestStrings") & return after fld TestStrings
  498.     delete line 1 of fld TestStrings
  499.   end repeat
  500.   delete line 1 of fld TestStrings
  501.  
  502.   hide message
  503.   show field "Insts"
  504.   show bkgnd button "Continue"
  505.   show btn id 10
  506.   show field "Header"
  507.   show field "Citation"
  508.   put line 1 of fld "TestStrings" into field "Citation"
  509.   hide field "Hider"
  510.   play "harpsichord" tempo 180 "at d5 a4 f d f4 a d5"
  511. end mouseUp
  512.  
  513.  
  514. -- part 19 (button)
  515. -- low flags: 00
  516. -- high flags: A003
  517. -- rect: left=398 top=309 right=331 bottom=498
  518. -- title width / last selected line: 0
  519. -- icon id / first selected line: 0 / 0
  520. -- text alignment: 1
  521. -- font id: 0
  522. -- text size: 12
  523. -- style flags: 0
  524. -- line height: 16
  525. -- part name: Quit
  526. ----- HyperTalk script -----
  527. on mouseUp
  528.   if (the freesize of this stack)/(the size of this stack) > 0.2 then
  529.     doMenu Compact Stack
  530.   end if
  531.   doMenu "Quit HyperCard"
  532. end mouseUp
  533.  
  534.  
  535.  
  536. -- part 20 (field)
  537. -- low flags: 81
  538. -- high flags: 2002
  539. -- rect: left=6 top=63 right=151 bottom=137
  540. -- title width / last selected line: 0
  541. -- icon id / first selected line: 0 / 0
  542. -- text alignment: 1
  543. -- font id: 0
  544. -- text size: 12
  545. -- style flags: 0
  546. -- line height: 16
  547. -- part name: Current File
  548.