//QM v2.5. Do not edit with text editor!!! //
3    
¥UÍËµ’cC_ˆƒ]Üè²Ô_ß6x*²g„®é‰
  Macro103 CSb 0 0
 This macro, together with function sort1, sorts selected text by date.
 1. Assign to this macro some trigger, eg Ctrl+Shift+B.
 2. Select all text so that macro can copy it.
 3. Press Ctrl+Shift+B. This macro copies selected text, processes it, and pastes back.
 Note: all formatting (eg, colors, bold, tables) will be lost.
 Note: if dates will be misordered, go to Control Panel -> Language and Regional Options, and set date format dd- MM-yyyy

 text example (before processing):
 (Sat) 20- 1-1990 21:38 Saturn (Sag) 165° [Gem] Pluto 
 (Wed) 23- 5-1991 20:59 Saturn [Cap] 162° (Gem) Pluto 
 (Mon) 25- 6-1990 18:59 Saturn [Cap] 165° (Gem) Pluto 
 (Sun) 20- 1-1990 20:56 Saturn (Cap) 162° [Gem] Pluto 

 after processing:
 (Sun) 20- 1-1990 20:56 Saturn (Cap) 162° [Gem] Pluto 
 (Sat) 20- 1-1990 21:38 Saturn (Sag) 165° [Gem] Pluto 
 (Mon) 25- 6-1990 18:59 Saturn [Cap] 165° (Gem) Pluto 
 (Wed) 23- 5-1991 20:59 Saturn [Cap] 162° (Gem) Pluto 


str s p; int i; ARRAY(str) a

s.getsel; if(!s.len) mes- "Please select text" ;;copy

p="(?s)^ *\(...\) +(\d\d? ?- ?\d\d? ?- ?\d{4} +\d\d?:\d\d?) .+?$" ;;regular expression
if(findrx(s p 0 4|8 a)=0) mes- "Failed to parse" ;;parse into array a

qsort &a[0 0] a.len sizeof(str)*2 &sort1 ;;sort array

s=""
for(i 0 a.len) s.formata("%s[]" a[0 i]) ;;glue ordered array

 out s
s.setsel

  sort1  8 0
 /
function[c]# str*a str*b

DATE d1=a[1]
DATE d2=b[1]

if(d1>d2) ret 1
else if(d1<d2) ret -1

  file  268500992 0

  