| 
		
	
	
	
		
	Posts: 1,058Threads: 367
 Joined: Oct 2007
 
	
	
		Dear Gintaras,I understand that the option to sort QM items (former men 33166) is now removed in version 2.4.0. I wonder whether there exists another way to sort. It was very useful. Please advise.
 Best regards.
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Doesn't exist. Now when using database to store macros, difficult to implement ordering. I never used this feature, and decided to remove it as probably rarely used.
	 
	
	
	
		
	Posts: 1,058Threads: 367
 Joined: Oct 2007
 
	
	
		Thanks for this explanation. Kind regards, Simos.
	 
	
	
	
		
	Posts: 1,058Threads: 367
 Joined: Oct 2007
 
	
	
		This is a routine to sort alphabetically items in a folder. It is rather slow but it works. I will be happy to answer to any enquiries. 
 Function QM_Items_Sort_A str si.getmacro(getopt(itemid) 1)str caller.getmacro(getopt(itemid 1) 1);err    caller=si
 if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller
 
 str name sfol
 sfol=Get_MacroPath(1)
 int i
 _s.from("Please Confirm to proceed with items in folder : " sfol)
 i=mes(_s "Sort Items in Folder Alphabetically"  "OC?")
 if i != 79
 ,ret
 
 ;Find first item under folder folder
 ARRAY(QMITEMIDLEVEL) a
 if(!GetQmItemsInFolder(sfol &a)) end "failed" ;; attention : a contains all level folders
 name.getmacro(a[0].id 1)
 
 ARRAY(str) Items
 QM_Items_InFolder_Alpha(sfol Items)
 
 ;for i 0 Items.len
 ,;out Items[i]
 ;ret
 ;Start looping
 int n=Items.len
 for i 0 n
 ;,out Items[i]
 ;,Find Source and select it
 ,mac+ Items[i]
 ,men 33074 _hwndqm ;;Check
 ,0.5
 ;,Find Target
 ,mac+ name
 ,0.5
 ,if i; key D
 ;,Move Source here
 ,men 33075 _hwndqm ;;Move checked
 ,name=Items[i]
 ,0.5
 
 _s.format("Alphabetical Sorting (items %i) concluded in folder : %s" n sfol)
 Task_Message _s 0 0 1
 bee 1000 1000
 
 ret
Function Get_MacroPath ;/function~ [int'sw] [str&qname]
 
 ;sw=0 : full path
 ;sw=1 : Parent folder
 ;sw=2 : Parent folder in Clipboard
 
 str si.getmacro(getopt(itemid) 1)
 str caller.getmacro(getopt(itemid 1) 1);err    caller=si
 if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller
 
 str sQMPath
 str qn=Get_MacroName(1)
 if(&qname); qname=qn
 
 GetQmItemPath qn  sQMPath
 
 if sw > 0
 ,int i=findcr(sQMPath "\")
 ;,out i
 ,sQMPath.remove(i)
 ,;
 ,if sw=2; sQMPath.setclip
 ret sQMPath
Function QM_Items_InFolder_Alpha function [str'inFol] [ARRAY(str)&Items] [int'isor]str si.getmacro(getopt(itemid) 1)
 str caller.getmacro(getopt(itemid 1) 1);err    caller=si
 if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller
 
 ;140809 : System macro : GetQmItemsInFolder
 ;No subfolders
 
 int mFolder m i j l n
 ARRAY(int) k
 QMITEM q
 str sText s sRec sfol
 sRec="$temp$\QMitems.txt"
 
 File f.Open(sRec "w")
 
 ;*************
 str sFolder=Get_MacroPath(1)
 
 if empty(inFol)
 ,i=inp(sfol "Give a folder name (Backslash \ or empty for root)" "Alphabetise items in QM folder" sFolder)
 ,if i=0; ret
 ;,sfol="\SES\MLO"
 ;,sfol="\SES\Acrobat"
 ,if empty(sfol) ;; All folders
 ,,sfol="\"
 else
 ,sfol=inFol
 
 _i=sfol.IsQMFolder
 
 if _i=0; ret
 mFolder=_i
 
 ;*************
 
 ARRAY(QMITEMIDLEVEL) a
 if(!GetQmItemsInFolder(sfol &a)) end "failed" ;; attention : a contains all level folders
 int nm=a.len
 
 str sl unsrt
 int n0=0
 for i 0 nm
 ;,out "%.*m%s" a[i].level 9 _s.getmacro(a[i].id 1)
 ;,sl.format("%3i %.*m%s[]" i+1 a[i].level 9 _s.getmacro(a[i].id 1))
 ,if a[i].level=0
 ,,n0=n0+1
 ,,_s.getmacro(a[i].id 1)
 ;,,sl.format("%3i %s[]" n0 _s)
 ,,unsrt.formata("%s[]" _s)
 if isor
 ,unsrt.Sort(1)
 else
 ,unsrt.Sort
 ;out unsrt
 ;out n0
 
 _s.format("%s : %i" sfol n0)
 int x y
 GetWinXY(win("Quick Macros") x y)
 
 ShowTooltip_Smart _s 10 x+25 y+25 300 7 "QM items in folder" "%IconFol%\qm_exe_20.ico"
 
 if(&Items)
 ,for i 0 nm
 ,,_s.getl(unsrt i)
 ,,Items[Items.redim(-1)]=_s
 ,ret
 
 
 sText.format("Folder : %s - Folder id : %i - Items : %i[][]" sfol mFolder n0)
 f.Write(sText)
 
 f.Write(unsrt)
 err
 ,_s=_error.description
 ,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
 ,mac "Warning_QM" si
 ,end
 f.Close
 
 str shw.from("Macros in Folder : " sfol)
 rep
 ,j=ShowTextAndReturnLineIndex(shw unsrt 0 0 24 "" 11 0 0 5)
 ;;;;;1      2      3         4         5         6          7           8          9        10        11       12      13      14         15          16
 ;,$caption $text [$Tasks] [hwndowner] [flags] [$fontname] [fontsize] [fontstyle] [fcolor] [winsize] [wheight] [ShTx] [ShTy] [$ShTIcon] [$ToolBar] [str&sText]
 ,if j<0
 ,,ret (`
 n)0(`)
 
 
 ,j=j+1
 ,
 ,str sf.getl(unsrt j-1)
 ,
 ,mac+ sf
 ,
 wait 10 -WC win("shw")
 err
 ,_s=_error.description
 ,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
 ,mac "Warning_QM"
 ,end
 shutdown -6 0 "ShowTooltip_Smart"
 
 ret
 |