Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write the sort result to the original file
#2
something like this

just need to get the starting position and the end position of the text
then select the text and paste sorted text 

Code:
Copy      Help
str s=sub.getAutotextItem("At")
ARRAY(str) a=s
a.sort(2)
s=a
out s
;code: Write the sort result to the original file
mac+ "At"
int h=GetQmCodeEditor
SendMessage(h SCI.SCI_GOTOLINE 1 0)
int ssp=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(h SCI.SCI_GOTOLINE 1+numlines(s) 0)
int sep=SendMessage(h SCI.SCI_GETCURRENTPOS 0 0)
SendMessage(h SCI.SCI_SETSEL ssp sep)
s.setclip
SendMessage(h SCI.SCI_PASTE 0 0)
#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].trim)
ret d


Messages In This Thread
RE: How to write the sort result to the original file - by Kevin - 06-28-2019, 02:56 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)