The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write the sort result to the original file
#1
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
Code:
Copy      Help
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     Help - how to add the trigger to the macro
Code:
Copy      Help
/b/i/c/m
bn :sub.Sub2 ;;comment2
cn :sub.Sub3 ;;comment3
an :sub.Sub1 ;;comment1

#sub Sub1
key "an"


#sub Sub2
key "bn"


#sub Sub3
key "cn"


Messages In This Thread
How to write the sort result to the original file - by win - 06-28-2019, 05:44 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)