Clipboard copy triggers

Functions, classes, components, etc. Only high quality content.

Clipboard copy triggers

Postby Gintaras on Tue Mar 03, 2009 8:03 pm

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.
Attachments
Clipboard Triggers.qml
(3.64 KiB) Downloaded 985 times
Gintaras
Site Admin
 
Posts: 10411
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Clipboard copy triggers

Postby ssimop on Fri Aug 09, 2013 3:42 pm

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.
User avatar
ssimop
Active Member
 
Posts: 916
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Clipboard copy triggers

Postby Gintaras on Fri Aug 09, 2013 4:46 pm

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.
Gintaras
Site Admin
 
Posts: 10411
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Clipboard copy triggers

Postby ssimop on Fri Aug 09, 2013 4:52 pm

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.

Simos
User avatar
ssimop
Active Member
 
Posts: 916
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Clipboard copy triggers

Postby ssimop on Sat Aug 10, 2013 9:58 am

Dear Gintaras,

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

Regards, Simos
Attachments
Image_130810125420.bmp
Image_130810125420.bmp (175.55 KiB) Viewed 9443 times
User avatar
ssimop
Active Member
 
Posts: 916
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Clipboard copy triggers

Postby ssimop on Sat Aug 10, 2013 10:36 am

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
User avatar
ssimop
Active Member
 
Posts: 916
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Clipboard copy triggers

Postby Gintaras on Sun Aug 11, 2013 6:01 am

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

Macro Macro2120     ?
shutdown -6 0 "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

Gintaras
Site Admin
 
Posts: 10411
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Clipboard copy triggers

Postby ssimop on Sun Aug 11, 2013 6:08 am

Dear Gintaras,

Many thanks. This is actually what I was doing, but in a more "manual" way. Much obliged, Best personal regards, Simos.
User avatar
ssimop
Active Member
 
Posts: 916
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Clipboard copy triggers

Postby Gintaras on Sun Sep 21, 2014 2:26 pm

Function my_clipboard_triggers     ?
\Dialog_Editor

;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=
;BEGIN DIALOG
;0 "" 0x80C800C8 0x0 0 0 224 136 "My Clipboard Triggers"
;END DIALOG
;DIALOG EDITOR: "" 0x2040201 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,int-- t_hwndnext=SetClipboardViewer(hDlg)
,SetTimer hDlg 23 1000 0
,
,case WM_DESTROY
,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
,
,case WM_CHANGECBCHAIN
,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
ret

;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"
,
,;...

err+

Gintaras
Site Admin
 
Posts: 10411
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania


Return to QM Extensions

Who is online

Users browsing this forum: No registered users and 2 guests