Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clipboard copy triggers
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.

Attached Files
.qml   Clipboard Triggers.qml (Size: 3.64 KB / Downloads: 1,214)
Dear Gintaras,

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.

Any advice much appreciated.

Best regards, Simos.
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.
Deast Gintaras,

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.

Dear Gintaras,

Working continuously since my last post, I just realised that clipboard copy tigger ceased responding. The thread is still there.

Regards, Simos

Attached Files Image(s)
Dear Gintaras,

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?

Many thanks, Best regards
Trigger threads should not be killed/restarted. But if need, use this code:

Macro Macro2120
Copy      Help
shutdown -6 0 "clipboard_copy_triggers"
;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
Dear Gintaras,

Many thanks. This is actually what I was doing, but in a more "manual" way. Much obliged, Best personal regards, Simos.
Function my_clipboard_triggers
Copy      Help

;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

str dd=
;0 "" 0x80C800C8 0x0 0 0 224 136 "My Clipboard Triggers"
;DIALOG EDITOR: "" 0x2040201 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0 HWND_MESSAGE 128)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,int-- t_hwndnext=SetClipboardViewer(hDlg)
,SetTimer hDlg 23 1000 0
,ChangeClipboardChain hDlg t_hwndnext
,case WM_TIMER
,sel wParam
,,case 23 ;;auto restore if another viewer did not remove itself correctly
,,if(!GetClipboardViewer) t_hwndnext=SetClipboardViewer(hDlg)
,case WM_COMMAND ret 1
,if(wParam=t_hwndnext) t_hwndnext=lParam
,else if(t_hwndnext) SendMessage t_hwndnext message wParam lParam
,case WM_DRAWCLIPBOARD ;;clipboard contents changed
,SendMessage t_hwndnext message wParam lParam
,goto onEvent

str s.getclip; err ret
;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"


Forum Jump:

Users browsing this thread: 1 Guest(s)