Download and import this, and you will have "Clipboard copy" trigger type in Properties.
The macro runs when you copy text in any program and it matches or contains specified text.
There exist cases that this trigger ceases working. I still cannot find why. In any case relevant macros, in folder Clipboard Triggers, are not disabled by the user. Furthermore, they do not show at their side any disable icon. How could this can be justified? Moreover to re-enable this trigger you have to exit QM and restart it. Is there any other fast way to re-enable? I tried a couple but I failed.
Look in Running items pane, is clipboard_copy_triggers thread running when triggers don't work? It may be hidden, need to check 'Show hidden Running items' in Options -> General.
Thanks for an extremely fast response, as usually with You and QM! Yes, this very moment, that this trigger is working perfrctly, it is running. I will let you know when the trgger will cease working.
I am sorry for any inconvenience, it was my fault. One of my macros was incidentally and by mistake killing the thread. Nevertheless, the thread was itself re-generated, but not working properly. I understand this thread is generated when QM is loaded-started. Could you please advise on the way to restart it when QM is running?
shutdown-60"clipboard_copy_triggers" 0.5 ;mac "clipboard_copy_triggers" ;;will not work. The thread must be started by the trigger management function, which must be called by QM; QM passes trigger data to it. ;Need to restart QM, or reload file. ;Or add a trigger of this type: int iid=newitem("""""""^Clipboard_copy ``""\User\Temp"128) newitem iid """""""\User\Temp"32;;delete
;A lightweight version of clipboard triggers. Can be used in exe. Not integrated into the Properties dialog. ;To define strings and macros, edit the sel code at the end.
AddTrayIcon"$qm$\copy.ico""Clipboard triggers.[]Ctrl+click to exit.";;remove this if don't need tray icon
sel message ,caseWM_INITDIALOG ,int-- t_hwndnext=SetClipboardViewer(hDlg) ,SetTimer hDlg 2310000 , ,caseWM_DESTROY ,ChangeClipboardChain hDlg t_hwndnext , ,caseWM_TIMER ,sel wParam ,,case23;;auto restore if another viewer did not remove itself correctly ,,if(!GetClipboardViewer) t_hwndnext=SetClipboardViewer(hDlg) , ,caseWM_COMMANDret1 , ,caseWM_CHANGECBCHAIN ,if(wParam=t_hwndnext) t_hwndnext=lParam ,elseif(t_hwndnext)SendMessage t_hwndnext message wParam lParam , ,caseWM_DRAWCLIPBOARD;;clipboard contents changed ,SendMessage t_hwndnext message wParam lParam ,goto onEvent ret
;onEvent str s.getclip;errret ;out s
;edit this code: add/remove case statements with your strings and functions sel s 2;;flag 2 - wildcard. In recent QM versions you also can use flag 4 to support regular expressions. ,case"*Quick*" ,out"Quick" ,;mac "Function301" ;;runs Function301 in new thread. Or you can call it directly, if its execution time is less than 0.1 s. , ,case"*Macros*" ,out"Macros" ,;mac "Function302" , ,;...