:) Thank you Chris ! Jean-Christophe
> On Jun 20, 2018, at 8:32, Christopher Stone <[email protected]> > wrote: > > On 06/10/2018, at 08:03, Jean-Christophe Helary <[email protected] > <mailto:[email protected]>> wrote: >> If there was a way to separate point and mark. I could leave the mark where >> I want, jump to some place in the document and I would have a selection. >> >> I guess that's a valid feature request ? > > > Hey Jean-Christophe, > > You can do that with two scripts. (Appended.) > > A script that records the current insertion location. > > And a script that will select from the recorded “marker” to the current > cursor location in the front document. > > Save them as compiled scripts using the Script Editor.app. > > Give them relevant keyboard shortcuts. > > Go-to-town. > > This line in script 2 is vitally important: > > set scriptFile to alias ((path to application support from user domain as > text) & "BBEdit:Scripts:Mark_01.scpt") > > The script name MUST be correct. > > The script will function correctly when moving either forward or backward in > the document. > > Once again I've provided no error-checking. I added a very generic > error-handler to script 2 as an example. > > I have not provided multiple document support. > > Presently the marker is stored in the Marker_01 script and has no specific > linkage to the document, so it is very perishable. > > If I was going to move beyond proof-of-concept I'd consider storing the > marker in a text file on a per-document basis using the document name and > character offset of the insertion location. Reading, writing, and > maintaining this would be a trivial exercise with `sed` and would be very > fast. > > -- > Take Care, > Chris > > > The Mark Script > > > ---------------------------------------------------------------- > # Auth: Christopher Stone > # dCre: 2018/06/10 22:19 > # dMod: 2018/06/10 22:19 > # Appl: BBEdit > # Task: Create Marker 01 for use in other scripts. > # Libs: None > # Osax: None > # Tags: @Applescript, @Script, @BBEdit, @Create, @Marker > ---------------------------------------------------------------- > > property insertionLocation : "" > > tell application "BBEdit" > tell front text window > set insertionLocation to selection > end tell > end tell > > ---------------------------------------------------------------- > > > > The Select-from-Cursor-Location-to-Marker Script > > > ---------------------------------------------------------------- > # Auth: Christopher Stone > # dCre: 2018/06/10 22:19 > # dMod: 2018/06/10 22:19 > # Appl: BBEdit > # Task: Select from Marker 01 to current cursor location. > # Libs: None > # Osax: None > # Tags: @Applescript, @Script, @BBEdit, @Select, @Marker, @Current, @Cursor, > @Location > ---------------------------------------------------------------- > > try > > set scriptFile to alias ((path to application support from user domain as > text) & "BBEdit:Scripts:Mark_01.scpt") > set markScript to load script scriptFile > > tell application "BBEdit" > tell front text window > set markedInsertionLocation to markScript's insertionLocation > set insertionLocation to selection > > set markedCharacterOffset to (characterOffset of > markedInsertionLocation) > set currentCharacterOffset to (characterOffset of > insertionLocation) > > if markedCharacterOffset < currentCharacterOffset then > set startChar to markedCharacterOffset > set endChar to currentCharacterOffset - 1 > else > set startChar to currentCharacterOffset > set endChar to markedCharacterOffset - 1 > end if > > select (characters startChar thru endChar) > > 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 > > ---------------------------------------------------------------- > > > > > -- > 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>. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune -- 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.
