I made a little progress through searching and found I could paste into the dialog if I went to the finder first. Does anyone know why this change in BBedit?
tell application "Finder"
-- initial dialog box to get user requested product
set theUniqueName to the text returned of (display dialog "Enter a unique identifier (name or number) of the product you would like to delete" default answer "")
end tell
tell application "BBEdit"
set errorTotals to 0 as number
repeat with i in (get every text document)
tell i's text
set tagLength to 41 + 1
set colorCodeLength to 8
set specialClassesLength to 2
set thumbsStart to "<thumbs>"
set thumbsFinish to "</thumbs>"
set headlineColors to "headlineColors"
set subheadlineColors to "subheadlineColors"
set legalColors to "legalColors"
set specialClasses to "specialClasses"
set msg to ""
set msg1 to ""
set msg2 to ""
set msg3 to ""
set msg4 to ""
set msg1a to ""
set msg2a to ""
set msg3a to ""
set msg4a to ""
set totalProducts to 0
set chk to 0
set theText to ""
set startTitle to ""
set endTitle to ""
set tempTitle to ""
set tempTitleStrg to ""
--get name of this particular template xml
select character (9) of line 3
set startTitle to characterOffset of selection
set endTitle to startTitle + 30
select (characters startTitle thru endTitle)
copy selection to tempTitle
set tempTitleStrg to (tempTitle as string)
--display alert ("this is my test alert" & tempTitleStrg)
find theUniqueName options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
-- puts line where cursor sits into productLineCount
copy the startLine of selection to productLineCount
--find the line that the thumbs tag is on
find thumbsStart options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to thumbsStartCount
find thumbsFinish options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to thumbsFinishCount
if (productLineCount is less than or equal to thumbsStartCount) or (productLineCount ≥ thumbsFinishCount) then
set errorTotals to ((errorTotals) + 1)
--display alert "Another Error total =" & errorTotals
else
set totalProducts to (thumbsFinishCount - thumbsStartCount - 1)
copy the startLine of selection to currLine
--COUNT NUMBER OF PIPE CHARACTERS IN SPECIAL CLASSES LINE HERE
set theText to (the line currLine as string)
--set search delimiters then reset when done
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "|"
set pipeCount to (count theText's text items) - 1
set AppleScript's text item delimiters to astid
-- here is where deletions work is done below
-- and subtract it from the thumbs line
set productNumber to productLineCount - thumbsStartCount
set productColor to productNumber - 1
-----------------------------------------------
--Delete the entire line that the product is on
set deleteProductLine to line productLineCount
delete every character of deleteProductLine
-------------------------------------------------
--LINE COUNT 1
--find the text color tag and get its line number and set var lineCount1
find headlineColors options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to lineCount1
--select first char of chosen product color
select character (productColor * colorCodeLength + tagLength) of line lineCount1 --? append 'of text'?
set startMark to characterOffset of selection
-- and find next pipe char and extend selection
set targetColor to find "[|]" options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:true} with extend selection
set endMark to characterOffset of targetColor's found object
select (characters startMark thru endMark)
set text of selection to ""
-----------------------------------------------
--LINE COUNT 2
--find the text color tag and get its line number and set var lineCount2
find subheadlineColors options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to lineCount2
--select first char of chosen product color
select character (productColor * colorCodeLength + tagLength) of line lineCount2
set startMark to characterOffset of selection
-- and find next pipe char and extend selection
set targetColor to find "[|]" options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:true} with extend selection
set endMark to characterOffset of targetColor's found object
select (characters startMark thru endMark)
set text of selection to ""
-----------------------------------------------
--LINE COUNT 3
--find the text color tag and get its line number and set var lineCount3
find legalColors options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to lineCount3
--select first char of chosen product color
select character (productColor * colorCodeLength + tagLength) of line lineCount3
set startMark to characterOffset of selection
-- and find next pipe char and extend selection
set targetColor to find "[|]" options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:true} with extend selection
set endMark to characterOffset of targetColor's found object
select (characters startMark thru endMark)
set text of selection to ""
-----------------------------------------------
--LINE COUNT 4
--find the text color tag and get its line number and set var lineCount4
find specialClasses options {search mode:text, starting at top:true, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
copy the startLine of selection to lineCount4
--TEST COMMENT BELOW OUT
--set i to replace_chars(i, "gradient", "%") of me
-------------------------------------------------
--select first char of chosen product color
select character (productColor * specialClassesLength + tagLength) of line lineCount4
set startMark to characterOffset of selection
-- and find next pipe char and extend selection
set targetColor to find "[|]" options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:true} with extend selection
set endMark to characterOffset of targetColor's found object
select (characters startMark thru endMark)
set text of selection to ""
--TEST COMMENT BELOW OUT
--set i to replace_chars(i, "%", "gradient") of me
--end if
end if
end tell
end repeat
display alert ("DONE! Total Templates with Missing Products/Errors:" & errorTotals)
end tell
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
--set the item_list to every text item of this_text
set the item_list to this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list --as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
--if (contents of line 1 contains "; This ") and (contents of line 2 = "") then
--delete text of lines 1 thru 2
--end if