Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort items in a qm folder
Not really important but if someone has a script that sorts the items in a QM folder and is willing to post it here, I would really appreciate it.
Dear r0n, I have written such a script, I can send it right now to you. However, (a) I do not like it because it is slow (b) It calls a few localised to my PC QM items. I can rewrite the script to be PC-independent. It will need about 1 day. Please let me know accordingly. Regards, ssimop.
You may try the following script, and please let me know if you have any questions and/or comments.

Function QM_Items_Sort_Fo
Copy      Help
str name sfol sfol0

int i=qmitem("" 1 &q)
if !i; err "Error"; ret
sfol0.getmacro(q.folderid 1)
inp sfol "Give folder name to sort" "Sort QM items in a folder" sfol0

if(!GetQmItemsInFolder(sfol &a 1)) end "failed" ;; attention : a contains all level folders
name.getmacro(a[0].id 1)
ARRAY(str) Items
int nm=a.len

str sl unsrt
int n0=0
for i 0 nm
,if a[i].level=0
,,qmitem(a[i].id 0 q)
,,if q.itype=5; continue ;;exclude folderss
,,_s.getmacro(a[i].id 1)


;Start looping
BlockInput2 3
int n=Items.len
out n
for i 0 n
,mac+ Items[i]
,,err "1"
,men 33074 _hwndqm
,mac+ name
,if i; key D

,men 33075 _hwndqm ;;Move checked

_s=F"Alphabetical Sorting concluded in folder : %s {sfol}"
out _s
BlockInput2 0
Thank you very much for this!
It seems to be missing "Task_Message", could you include it?

Take your time, no haste.

But this will be very usefull for me, I need to reorder a lot of folders within my QM.
I am happy that it proves useful to you. I am sorry I missed to replace Task_Message by an "out" statement. Anyway, I attach herewith Task_Message. Regards.

Function Task_Message
Copy      Help
function# str'text [int'length] [int'color] [int'font_handle]

;---> Comment 30-08-2016 08:22:02 : New version CFont
;Task_Message "Hello there - Simple" 0 171 0
;Task_Message "Hello there - Bold" 0 171 1
;Task_Message "Hello there - Simple" 0 171 0
;Task_Message "Hello there - Font+1 Bold" 0 171 2

;Run Layered Products - My Color Dialog to select in clipboard any color
;Attention : Colors in QM are defined as BGR

;0x000000 - black
;0xFFFFFF - white
;0x0000FF - red
;0x00FF00 - green
;0xFF0000 - blue
;0x00FFFF - yellow (red+green)
;0xC0C0C0 - gray
;0x808080 - dark gray
;0x008000 - dark green

;length - message duration on taskbar
;>0 duration in s, then close
;=0 infinite, close when mouse click (monitor click through "Task_Message_Monitor") or by triggering "Task_Message_Shutdown"
;<0 infinite, close only by triggering "Task_Message_Shutdown"

;Test Program
;beeS 700 100
;Task_Message "matzuni" 0 150 1
;Task_Message "tamtiriri" 0 0 0
;Task_Message "tzuni matzuni" 0 255 1
;Task_Message "Time-out" -1 0xFF0000 0
;Task_Message "tzuni" 0
;Task_Message "matzuni" 0 150 1
;Task_Message "matzuni" 0 0 1

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 si caller
int hw
int ic=0


int hwTB=win("TB STATUSBAR" "QM_toolbar")
ifi hwTB
,;mac "TaMesShut" "" text length color font_handle
,clo hwTB
,wait 5 -WC hwTB ;; 120105 Παιδεύτηκα από 10:00 ως 17:00 για να βρω ότι χρειαζότανε αυτό,
,;;;;;;;;;;;;;;;;;;;εάν γίνεται δεύτερη κλήση της ρουτίνας στο ίδιο πρόγραμμα, και η πρώτη είχε sleep <=0 !
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,,mac "Warning_QM" si

str sm="Task_Message_Monitor"
if(IsThreadRunning(sm)); shutdown -6 0 sm


TaskM=iif(font_handle=0 0 font_handle+1)

int coloR=iif(color=0 0xFF0000 color)
;if color > 0 ; TaskM=iif(TaskM=0 1 TaskM)
TaskM=iif(TaskM=0 1 TaskM)

;out "%i %i" TaskM coloR

str smes

;---> Comment 29-11-2015 02:40:38 :
;Some functions and other QM features are unavailable in exe.
;mac can start only functions in exe

hwTB=mac("TB StatusBar")
hwTB=wait(15 WC win("TB STATUSBAR" "QM_toolbar"))
,_s.from(_error.description " - Called by " caller)
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,mac "Warning_QM" si
hw=id(1 win("TB STATUSBAR" "QM_Toolbar")); err ret
if TaskMFo
;,outt F"{TaskMFo} - {font_handle}"
,if font_handle=0
,else if font_handle=1
if TaskM
;idx[1]=0x000000;;- black
;idx[2]=0xFFFFFF;; - white
;idx[3]=0x0000FF;; - red
;idx[4]=0x00FF00;; - green
;idx[6]=0xFF0000;; - blue
;idx[7]=0x00FFFF;; - yellow (red+green)
;idx[8]=0xC0C0C0;; - gray
;idx[9]=0x808080;; - dark gray
;idx[10]=0x008000;; - dark green
;,It does not work properly with 2.3.0 - Unicode :
;,SetWindowText hw text
;,Following two work :
,SetWindowTextW hw @text     

,,_s.from(_error.description " - Called by " caller)
,,_s.format("%s - %s" si _s)
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,,mac "Warning_QM" si

if length < 0
if length = 0
;,wait(0 M)
,mac "Task_Message_Monitor"
wait length

ifi hwTB
,clo hwTB    
,;_s="Closed End"
,;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
I replaced the taks function with a simple out and it works! The t

The Task_Message function has some componentes/variables missing:

But if you replace the task_message function with a simple out, then it works perfectly
Thank you again.

For other users wanting to use this function:

1. Create new function 'QM_Items_Sort_Fo' in QM and copy contents from above 'QM_Items_Sort_Fo' into newly created function
2. You do not have to modify above function 'QM_Items_Sort_Fo' it is already corrected (you see below 'out _s')
3. To properly run this function you can do 2 things
    option 1: Drag the newly created QM function 'QM_Items_Sort_Fo' to a toolbar
    option 2: Assign a hotkey trigger to the newly created QM function 'QM_Items_Sort_Fo'
4. To use this function
   If you have a folder called 'abc' and want to re-order contents within folder 'abc' then select an item within 'abc' then run this function
   (By pressing the hotkey OR clicking it on the toolbar, depending on what you chose in step 3)

Thank you ssimop!!!

Forum Jump:

Users browsing this thread: 1 Guest(s)