Posts: 769
Threads: 263
Joined: Jul 2012
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.
Thanks!
Posts: 1,058
Threads: 367
Joined: Oct 2007
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.
Posts: 1,058
Threads: 367
Joined: Oct 2007
04-22-2020, 11:28 AM
(This post was last modified: 04-22-2020, 01:26 PM by 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
str name sfol sfol0
QMITEM q
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
ARRAY(QMITEMIDLEVEL) a
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)
,,Items[]=_s
Items.sort
;Start looping
BlockInput2 3
int n=Items.len
out n
for i 0 n
,mac+ Items[i]
,err
,,err "1"
,,end
,
,men 33074 _hwndqm
,0.5
,mac+ name
,0.5
,if i; key D
,men 33075 _hwndqm ;;Move checked
,name=Items[i]
,0.5
_s=F"Alphabetical Sorting concluded in folder : %s {sfol}"
out _s
BlockInput2 0
ret
Posts: 769
Threads: 263
Joined: Jul 2012
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.
Posts: 1,058
Threads: 367
Joined: Oct 2007
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
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
;www.quickmacros.com/forum/viewtopic.php?f=1&t=2495
;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
;3
;Task_Message "tamtiriri" 0 0 0
;3
;Task_Message "tzuni matzuni" 0 255 1
;3
;Task_Message "Time-out" -1 0xFF0000 0
;3
;Task_Message "tzuni" 0
;3
;Task_Message "matzuni" 0 150 1
;3
;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 _error.place si caller
TMtext=text
int hw
int ic=0
CHARRANGE cr
CHARFORMAT2 cf.cbSize=sizeof(CHARFORMAT2)
;********************
int hwTB=win("TB STATUSBAR" "QM_toolbar")
ifi hwTB
,;mac "TaMesShut" "" text length color font_handle
,;ret
,clo hwTB
,wait 5 -WC hwTB ;; 120105 Παιδεύτηκα από 10:00 ως 17:00 για να βρω ότι χρειαζότανε αυτό,
,;;;;;;;;;;;;;;;;;;;εάν γίνεται δεύτερη κλήση της ρουτίνας στο ίδιο πρόγραμμα, και η πρώτη είχε sleep <=0 !
,err
,,_s=_error.description
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end
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
sw_task=0
;---> 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"))
err
,_s.from(_error.description " - Called by " caller)
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,mac "Warning_QM" si
,end
,
hw=id(1 win("TB STATUSBAR" "QM_Toolbar")); err ret
if TaskMFo
;,outt F"{TaskMFo} - {font_handle}"
,if font_handle=0
,,fTask.SetFont(hw)
,else if font_handle=1
,,fTaskB.SetFont(hw)
,else
,,fTaskC.SetFont(hw)
,,
if TaskM
;idx[0]=0x0000FF
;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 :
;,text.setwintext(hw)
,SetWindowTextW hw @text
,cf.dwMask=CFM_COLOR
,cf.crTextColor=coloR
,SendMessage(hw EM_SETCHARFORMAT SCF_ALL &cf)
else
,text.setwintext(hw)
,err
,,_s.from(_error.description " - Called by " caller)
,,_s.format("%s - %s" si _s)
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end
if length < 0
,sw_task=1
,ret
,
if length = 0
;,wait(0 M)
,mac "Task_Message_Monitor"
,ret
,
wait length
ifi hwTB
,clo hwTB
,;_s="Closed End"
,;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,
Posts: 769
Threads: 263
Joined: Jul 2012
I replaced the taks function with a simple out and it works! The t
The Task_Message function has some componentes/variables missing:
ideb
TMtext
NowT
TaskM
sw_task
TaskMFo
fTask
fTaskB
fTaskC
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!!!
|