06-28-2019, 05:44 AM
I want to sort a specific area of an AutoText file, but I don't know how to write the sorted result to the original file.
Can someone give some advice? Thanks in advance
Macro Macro9
Autotext At
Trigger $t
Can someone give some advice? Thanks in advance
Macro Macro9
str s=sub.getAutotextItem("At")
ARRAY(str) a=s
a.sort(2)
s=a
s.trim
out s
;code: Write the sort result to the original file
#sub getAutotextItem
function~ ~name
str pattern="(?m)^(.+\s\:.+)"
_s.getmacro(name 0)
str ss d
int i
ARRAY(str) a
findrx(_s pattern 0 4 a)
for i 0 a.len
,d.formata("%s[]" a[0 i])
ret d.trim
Autotext At
Trigger $t