On 05/24/2021, at 21:44, Rich Siegel <[email protected] <mailto:[email protected]>> wrote: > This is a good script. Some feedback: as a matter of best practices and > future proofing, avoid targeting windows (or elements of them).
Hey Duncan, Here's the script using Rich's suggested best practices. I'm using the top table on this page as my test data: https://material.angular.io/components/table/examples <https://material.angular.io/components/table/examples> -- Best Regards, Chris -------------------------------------------------------- # Auth: Christopher Stone <[email protected] <mailto:[email protected]>> # dCre: 2021/05/24 21:24 # dMod: 2021/05/25 17:04 # Appl: BBEdit # Task: Copy Safari Table to New BBEdit Document and Find-Replace. # : (Following Best Practices) # Libs: None # Osax: None # Tags: @Applescript, @Script, @BBEdit, @Table, @RegEx, @Massage, @Data # Vers: 1.50 -------------------------------------------------------- set jsCmdStr to " (() => { return window.getSelection().toString() })(); " set tableContent to doJavaScriptInSafari(jsCmdStr) tell application "BBEdit" activate set newDoc to make new text document with properties {text:tableContent} # Resize and reposition the new document. # {x1, y1, x2, y2} Upper-Left-Corner, Lower-Right-Corner. set bounds of front window to {0, 45, 1314, 1196} tell newDoc replace "Carbon|Helium" using "••••••" options {search mode:grep, case sensitive:false, starting at top:true} end tell end tell -------------------------------------------------------- -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/47581AFF-A968-4C3A-958E-FD6F60DA28C6%40gmail.com.
