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
delete char 1 of field "Citation"
end repeat
end mouseUp
-- part 10 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=209 top=258 right=309 bottom=328
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Save Citation
----- HyperTalk script -----
on mouseUp
global infnamesh
set cursor to 4
put field "Citation" & return after field "Final Citations"
click at 500,160
put empty into field "Citation"
delete line 1 of field "TestStrings"
get line 1 of field "TestStrings"
if it is not empty then
put line 1 of field "TestStrings" into field "Citation"
exit mouseUp
else
hide btn id 11
show field "Hider"
put empty into field "Citation"
put "Sorting citation list..."
set cursor to 4
put SortField(fld "Final Citations") into field "Final Citations"
set scroll of field "Final Citations" to 0
hide message
answer "Do you want duplicate citations removed?" with "Yes" or "No"
if it = "Yes" then
put "Removing duplicates..."
repeat with i=1 to 100000
set cursor to busy
repeat until line i of field "Final Citations" <> line i+1 of field "Final Citations"
delete line i+1 of field "Final Citations"
end repeat
if line i+1 of field "Final Citations" is empty then exit repeat
end repeat
hide message
end if
put item 1 of the topLeft of cd window into lft
put item 2 of the topLeft of cd window into tp
put infnamesh & ".CIT" into outfnamesh
put IOQuery(lft,tp,"o","Save citations to file:",outfnamesh) into filout
if filout = "Error" or filout = "cancel" then --EXIT IF FILE ERROR
if filout = "Error" then
beep
answer "Encountered error in creating file"
end if
show btn id 11
hide fld "Hider"
exit mouseUp
end if
open file filout
write "Citation list for text file " & infnamesh & ":" & return & return & field "Final Citations" to file filout
close file filout
hide field "Final Citations"
put empty into field "Current File"
hide field "Current File"
show field "Description"
show bkgnd button id 18
show bkgnd button "Go to Word"
show bkgnd button "Quit"
put "POSSIBLE CITATIONS" into field "Header2"
end if
end mouseUp
-- part 13 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=354 top=257 right=308 bottom=470
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Ignore
----- HyperTalk script -----
on mouseUp
set cursor to 4
delete line 1 of field "TestStrings"
get line 1 of field "TestStrings"
if it is not empty then
put line 1 of field "TestStrings" into field "Citation"
exit mouseUp
else
global infnamesh
hide btn id 11
show field "Hider"
put empty into field "Citation"
put "Now sorting citation list..."
set cursor to 4
put SortField(fld "Final Citations") into field "Final Citations"
set scroll of field "Final Citations" to 0
hide message
answer "Do you want duplicate citations removed?" with "Yes" or "No"
if it = "Yes" then
repeat with i=1 to 100000
set cursor to busy
repeat until line i of field "Final Citations" <> line i+1 of field "Final Citations"
delete line i+1 of field "Final Citations"
end repeat
if line i+1 of field "Final Citations" is empty then exit repeat
end repeat
end if
put item 1 of the topLeft of cd window into lft
put item 2 of the topLeft of cd window into tp
put infnamesh & ".CIT" into outfnamesh
put IOQuery(lft,tp,"o","Save citations to file:",outfnamesh) into filout
if filout = "Error" or filout = "cancel" then --EXIT IF FILE ERROR
if filout = "Error" then
beep
answer "Encountered error in creating file"
end if
show btn id 11
hide fld "Hider"
exit mouseUp
end if
open file filout
write "Citation list for text file " & infnamesh & ":" & return & return & field "Final Citations" to file filout
close file filout
hide field "Final Citations"
put empty into field "Current File"
hide field "Current File"
show field "Description"
show bkgnd button id 18
show bkgnd button "Go to Word"
show bkgnd button "Quit"
put "POSSIBLE CITATIONS" into field "Header2"
end if
end mouseUp
-- part 6 (field)
-- low flags: 81
-- high flags: 2001
-- rect: left=9 top=189 right=334 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Insts
-- part 7 (button)
-- low flags: 80
-- high flags: A003
-- rect: left=399 top=311 right=333 bottom=499
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Continue
----- HyperTalk script -----
on mouseUp
hide bkgnd button "Continue"
hide btn id 10
hide field "Insts"
show bkgnd button "Delete First Word"
show bkgnd button "Save Citation"
show bkgnd button "Ignore"
show btn id 11
put empty into field "Final Citations"
put "CITATION LIST" into field "Header2"
show field "Final Citations"
end mouseUp
-- part 11 (field)
-- low flags: 80
-- high flags: 0007
-- rect: left=154 top=43 right=178 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Final Citations
-- part 12 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=238 top=24 right=41 bottom=401
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: HEADER2
-- part 15 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=10 top=190 right=333 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Hider
-- part 16 (field)
-- low flags: 01
-- high flags: 2001
-- rect: left=10 top=189 right=333 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Description
-- part 17 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=14 top=309 right=331 bottom=114
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Go to Word
----- HyperTalk script -----
on mouseUp
open "Microsoft Word"
end mouseUp
-- part 18 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=208 top=309 right=331 bottom=308
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Continue
----- HyperTalk script -----
on mouseUp
global infnamesh
put item 1 of the topLeft of cd window into lft
put item 2 of the topLeft of cd window into tp
put IOQuery(lft,tp,"i") into infname
if infname = "Error" or infname = "cancel" then
if infname = "Error" then
beep
answer "Encountered error in locating/reading file"
end if
hide MenuBar
exit mouseUp
end if
put GetFileName(infname,"") into infnamesh
set cursor to 4
go cd "Program Card"
hide bkgnd button id 18
hide bkgnd button "Go to Word"
hide bkgnd button "Quit"
hide field "Description"
put "CURRENT FILE:" & return & infnamesh into field "Current File"
put "Searching for possible citations... this may take a while"
open file infname
click at 500,63
put empty into field "TestStrings"
put empty into oldline
put 0 into blline
put empty into thestring
read from file infname until return
put it into theline
put the number of words in theline into numwords
put 0 into oldlasti
put 0 into skipnext
put -1 into oldnumwds
repeat until blline > 15
set cursor to busy
put 0 into lasti
if numwords < 2 and offset("1",theline) = 0 then
add 1 to blline
read from file infname until return
put it into theline
put the number of words in theline into numwords
next repeat
else
put 0 into blline
end if
if offset("1",theline) <> 0 then
repeat with i = 1 to numwords
put word i of theline into theword
if char 1 of theword <> "1" and char 1 of theword <> "(" then next repeat
if the number of chars in theword < 4 then next repeat
if chartonum(char 3 of theword) > 57 or chartonum(char 3 of theword) < 48 then next repeat
put getdate(theword) into thedate
if oldlasti = oldnumwds and i = 1 then
put thestring && thedate & return after field "TestStrings"
click at 500,160
else
if i <> 1 and i = lasti+1 then
put thestring && thedate & return after field "TestStrings"
click at 500,160
else
put empty into thestring
if i > 7 then -- IF MORE THAN 7 PREV WORDS IN THE LINE...
put i-1 into begloop
put i-6 into endloop
if endloop < lasti then
put lasti+1 into endloop
end if
repeat with j = begloop down to endloop
put " " & word j of theline before thestring
end repeat
else
if i > 1 then
put i-1 into begloop
put 1 into endloop
if endloop <= lasti then
put lasti+1 into endloop
put 1 into skipnext
end if
repeat with j = begloop down to endloop
put " " & word j of theline before thestring
end repeat
end if
if skipnext < 1 and oldlasti <> oldnumwds and oldnumwds <> -1 then
put oldnumwds into begloop
if oldnumwds-(7-i) > -1 then
put oldnumwds-(7-i) into endloop
else
put 1 into endloop
end if
if endloop < oldlasti and oldlasti < oldnumwds-1 then
put oldlasti+1 into endloop
end if
repeat with j = begloop down to endloop
put " " & word j of oldline before thestring
end repeat
end if
end if
put thestring && thedate & return after field "TestStrings"
click at 500,160
end if
end if
put 0 into skipnext
put i into lasti
end repeat
put lasti into oldlasti
else
put 1 into oldlasti
end if
put theline into oldline
put numwords into oldnumwds
read from file infname until return
put it into theline
put the number of words in theline into numwords
end repeat
close file infname
if field "TestStrings" is empty then
answer "No citations found in " & infname with "OK"
show field "Description"
show bkgnd button id 18
show bkgnd button "Go to Word"
show bkgnd button "Quit"
put empty into field "Current File"
hide field "Current File"
hide message
exit mouseup
end if
put "Pre-editing citations..."
put "*$%@# " & return after fld TestStrings
repeat until word 1 of fld TestStrings = "*$%@#"
set cursor to busy
put getcit(line 1 of field "TestStrings") & return after fld TestStrings
delete line 1 of fld TestStrings
end repeat
delete line 1 of fld TestStrings
hide message
show field "Insts"
show bkgnd button "Continue"
show btn id 10
show field "Header"
show field "Citation"
put line 1 of fld "TestStrings" into field "Citation"
hide field "Hider"
play "harpsichord" tempo 180 "at d5 a4 f d f4 a d5"
end mouseUp
-- part 19 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=398 top=309 right=331 bottom=498
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Quit
----- HyperTalk script -----
on mouseUp
if (the freesize of this stack)/(the size of this stack) > 0.2 then