Try this (Note the use of pipes to protect the name from conversion):
*set* listSorted *to* *sort lines* *it* sorting options {|sort
pattern|:bbed_sortPattern,
sort subpattern:bbed_sortPattern} output options {replacing target:*true*}
Seems like AppleScript replaces the `sort pattern` by `match pattern` when
the script is compiled and that in turn confuses BBEdit.
HTH
Jean Jourdain
On Monday, March 21, 2022 at 4:56:39 PM UTC+1 [email protected] wrote:
> I have a Sort Lines… that works perfectly when I use BBEdit/Text/Sort
> Lines… menu with a text file, but when I attempt to write an AppleScript
> with the same Regex and replacement string I get the dreaded "BBEdit got an
> error: macOS error code: -1701 sort lines".
>
> I am writing something wrong in the Applescript and I could use some help.
>
> *set* bbed_sortPattern *to* "^(\\w+)(-.)? (.')?(\\w+){1}(-\\w+)?"
>
> *set* bbed_sortSubPattern *to* "\\3\\4\\1\\2"
>
> *tell* *application* "BBEdit"
>
> *tell* *text* *of* *front* *text window*
>
> *set* listSorted *to* *sort lines* *it* sorting options {match
> pattern:bbed_sortPattern, sort subpattern:bbed_sortPattern} output options
> {replacing target:*true*}
>
> *end* *tell*
>
> *end* *tell*
>
> The script debugger dictionary says that it should be "sorting options
> {sort pattern:" but Script Debugger stubbornly translates it as "sorting
> options {match pattern"; the problem does not seem to come from this.
>
> I would like to see an Applescript with the correct wording! Thank you
>
>
> *[image: BBEditSortLines.jpg]*
>
--
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/b41ec246-d35c-419f-aaf7-24173658a2ebn%40googlegroups.com.