Hey Chris, Very nice!
Congratulations and many thanks. Alfredo > On Aug 26, 2018, at 10:28 PM, Christopher Stone <[email protected]> > wrote: > > On 08/24/2018, at 13:54, Christopher Stone <[email protected] > <mailto:[email protected]>> wrote: >> On 08/20/2018, at 15:15, F. Alfredo Rego <[email protected] >> <mailto:[email protected]>> wrote: >>> Rich will probably give me some grief but here is what I did, in case my >>> fellow BBEdit users might find this useful. >> >> Here's a live working solution. >> >> It's a bit quick and dirty, so the formatting isn't as precise as I'd like – >> but I don't have time to do better right now. > > > Hey Alfredo, > > This is better and less of a hack. > > It produces a table, and it puts a regex in line one that will find each > bracketed string (and selects it). > > Cmd-Shift-E to enter the regular expression into the Find dialog behind the > scenes. > > Cmd-G to find the next string. > > I've provided the source text and a compiled AppleScript. > > -- > Best Regards, > Chris > > ---------------------------------------------------------------- > # Auth: Christopher Stone > # dCre: 2018/08/26 22:00 > # dMod: 2018/08/26 23:13 > # Appl: BBEdit, System Events > # Task: Export Find History to a BBEdit Text Document. > # : Include a regular expression for entry into Find via Cmd-Shift-E. > # Libs: None > # Osax: None > # Tags: @Applescript, @Script, @BBEdit, @System_Events, @Export, @Find, > @History, @Text, @Document > ---------------------------------------------------------------- > > try > > set shCMD to " > export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH; > plutil -convert xml1 ~/Library/Preferences/com.barebones.bbedit.plist -o > - > " > set thePlist to do shell script shCMD without altering line endings > > tell application "System Events" > set bbeditPlist to make new property list item with properties > {text:thePlist} > tell bbeditPlist to set plistValue to value of property list items of > property list items > > set collatorList to {} > > tell bbeditPlist > set FindDialog_SearchReplaceHistory_Value to value of property > list item "FindDialog_SearchReplaceHistory" > > tell FindDialog_SearchReplaceHistory_Value > repeat with theRecord in FindDialog_SearchReplaceHistory_Value > > tell theRecord > > set srchDate to (its SearchDate as «class isot») as > string > set srchDate to findReplTIDS("T", " ", srchDate) of me > > set srchStr to its SearchString > > try > set replStr to its ReplaceString > on error > set replStr to "" > end try > > set end of collatorList to srchDate & tab & "FIND: ❰" > & srchStr & "❱" & tab & "REPL: ❰" & replStr & "❱" > > end tell > > end repeat > end tell > > end tell > > end tell > > set AppleScript's text item delimiters to linefeed > set collatorList to collatorList as text > > set shCMD to " > export LANG=\"en_US.UTF-8\" > column -t -s$'\\t' <<< " & quoted form of collatorList > set collatorList to do shell script shCMD without altering line endings > > bbeditNewDoc(collatorList, true) of me > > tell application "BBEdit" > tell front text window > set before its text to "(?<=❰)\\S.*?(?=❱)" & linefeed & linefeed > select characters 1 thru -1 of line 1 > end tell > # open find window > # tell find window > # set selection to "(?<=❰)\\S.*?(?=❱)" > # # close > # end tell > end tell > > on error e number n > set e to e & return & return & "Num: " & n > if n ≠ -128 then > try > tell application (path to frontmost application as text) to set > ddButton to button returned of ¬ > (display dialog e with title "ERROR!" buttons {"Copy Error > Message", "Cancel", "OK"} ¬ > default button "OK" giving up after 30) > if ddButton = "Copy Error Message" then set the clipboard to e > end try > end if > end try > > ---------------------------------------------------------------- > --» HANDLERS > ---------------------------------------------------------------- > on bbeditNewDoc(_text, _activate) > tell application "BBEdit" > set newDoc to make new document with properties {text:_text, > bounds:{0, 44, 1920, 1200}} > tell newDoc > select insertion point before its text > end tell > if _activate = true or _activate = 1 or _activate = "activate" then > activate > end tell > end bbeditNewDoc > ---------------------------------------------------------------- > on findReplTIDS(_find, _replace, _string) > set oldTIDS to AppleScript's text item delimiters > set AppleScript's text item delimiters to _find > set _string to text items of _string > set AppleScript's text item delimiters to _replace > set _string to _string as text > end findReplTIDS > ---------------------------------------------------------------- > > > -- > This is the BBEdit Talk public discussion group. If you have a > feature request or would like to report a problem, please email > "[email protected]" rather than posting to the group. > Follow @bbedit on Twitter: <http://www.twitter.com/bbedit > <http://www.twitter.com/bbedit>> > --- > You received this message because you are subscribed to the Google Groups > "BBEdit Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/bbedit > <https://groups.google.com/group/bbedit>. > <Export Find History to a BBEdit Text Document.scptd.zip> > > -- > This is the BBEdit Talk public discussion group. If you have a > feature request or would like to report a problem, please email > "[email protected]" rather than posting to the group. > Follow @bbedit on Twitter: <http://www.twitter.com/bbedit > <http://www.twitter.com/bbedit>> > --- > You received this message because you are subscribed to the Google Groups > "BBEdit Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/bbedit > <https://groups.google.com/group/bbedit>. -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
